Skip to content

Commit bd2902e

Browse files
committed
Merge branch 'locking-fixes-for-fbnic-driver'
Alexander Duyck says: ==================== Locking fixes for fbnic driver Address a few locking issues that were reported on the fbnic driver. Specifically in one case we were seeing locking leaks due to us not releasing the locks in certain exception paths. In another case we were using phylink_resume outside of a section in which we held the RTNL mutex and as a result we were throwing an assert. ==================== Link: https://patch.msgid.link/175616242563.1963577.7257712519613275567.stgit@ahduyck-xeon-server.home.arpa Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 1cc8a5b + 6ede14a commit bd2902e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_netdev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ int __fbnic_open(struct fbnic_net *fbn)
5252
fbnic_bmc_rpc_init(fbd);
5353
fbnic_rss_reinit(fbd, fbn);
5454

55+
phylink_resume(fbn->phylink);
56+
5557
return 0;
5658
time_stop:
5759
fbnic_time_stop(fbn);
@@ -84,6 +86,8 @@ static int fbnic_stop(struct net_device *netdev)
8486
{
8587
struct fbnic_net *fbn = netdev_priv(netdev);
8688

89+
phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd));
90+
8791
fbnic_down(fbn);
8892
fbnic_pcs_free_irq(fbn->fbd);
8993

drivers/net/ethernet/meta/fbnic/fbnic_pci.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,12 @@ static void fbnic_service_task_start(struct fbnic_net *fbn)
118118
struct fbnic_dev *fbd = fbn->fbd;
119119

120120
schedule_delayed_work(&fbd->service_task, HZ);
121-
phylink_resume(fbn->phylink);
122121
}
123122

124123
static void fbnic_service_task_stop(struct fbnic_net *fbn)
125124
{
126125
struct fbnic_dev *fbd = fbn->fbd;
127126

128-
phylink_suspend(fbn->phylink, fbnic_bmc_present(fbd));
129127
cancel_delayed_work(&fbd->service_task);
130128
}
131129

@@ -443,11 +441,10 @@ static int __fbnic_pm_resume(struct device *dev)
443441

444442
/* Re-enable mailbox */
445443
err = fbnic_fw_request_mbx(fbd);
444+
devl_unlock(priv_to_devlink(fbd));
446445
if (err)
447446
goto err_free_irqs;
448447

449-
devl_unlock(priv_to_devlink(fbd));
450-
451448
/* Only send log history if log buffer is empty to prevent duplicate
452449
* log entries.
453450
*/
@@ -464,20 +461,20 @@ static int __fbnic_pm_resume(struct device *dev)
464461

465462
rtnl_lock();
466463

467-
if (netif_running(netdev)) {
464+
if (netif_running(netdev))
468465
err = __fbnic_open(fbn);
469-
if (err)
470-
goto err_free_mbx;
471-
}
472466

473467
rtnl_unlock();
468+
if (err)
469+
goto err_free_mbx;
474470

475471
return 0;
476472
err_free_mbx:
477473
fbnic_fw_log_disable(fbd);
478474

479-
rtnl_unlock();
475+
devl_lock(priv_to_devlink(fbd));
480476
fbnic_fw_free_mbx(fbd);
477+
devl_unlock(priv_to_devlink(fbd));
481478
err_free_irqs:
482479
fbnic_free_irqs(fbd);
483480
err_invalidate_uc_addr:

0 commit comments

Comments
 (0)