Skip to content

Commit 61a00c3

Browse files
ahduyckNipaLocal
authored andcommitted
fbnic: Fixup rtnl_lock and devl_lock handling related to mailbox code
The exception handling path for the __fbnic_pm_resume function had a bug in that it was taking the devlink lock and then exiting to exception handling instead of waiting until after it released the lock to do so. In order to handle that I am swapping the placement of the unlock and the exception handling jump to label so that we don't trigger a deadlock by holding the lock longer than we need to. In addition this change applies the same ordering to the rtnl_lock/unlock calls in the same function as it should make the code easier to follow if it adheres to a consistent pattern. Fixes: 82534f4 ("eth: fbnic: Add devlink dev flash support") Signed-off-by: Alexander Duyck <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 2c2e002 commit 61a00c3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,10 @@ static int __fbnic_pm_resume(struct device *dev)
442442

443443
/* Re-enable mailbox */
444444
err = fbnic_fw_request_mbx(fbd);
445+
devl_unlock(priv_to_devlink(fbd));
445446
if (err)
446447
goto err_free_irqs;
447448

448-
devl_unlock(priv_to_devlink(fbd));
449-
450449
/* Only send log history if log buffer is empty to prevent duplicate
451450
* log entries.
452451
*/
@@ -463,20 +462,20 @@ static int __fbnic_pm_resume(struct device *dev)
463462

464463
rtnl_lock();
465464

466-
if (netif_running(netdev)) {
465+
if (netif_running(netdev))
467466
err = __fbnic_open(fbn);
468-
if (err)
469-
goto err_free_mbx;
470-
}
471467

472468
rtnl_unlock();
469+
if (err)
470+
goto err_free_mbx;
473471

474472
return 0;
475473
err_free_mbx:
476474
fbnic_fw_log_disable(fbd);
477475

478-
rtnl_unlock();
476+
devl_lock(priv_to_devlink(fbd));
479477
fbnic_fw_free_mbx(fbd);
478+
devl_unlock(priv_to_devlink(fbd));
480479
err_free_irqs:
481480
fbnic_free_irqs(fbd);
482481
err_invalidate_uc_addr:

0 commit comments

Comments
 (0)