Skip to content

Commit dba35a4

Browse files
pkitszelanguy11
authored andcommitted
iavf: iavf_suspend(): take RTNL before netdev_lock()
Fix an obvious violation of lock ordering. Jakub's [1] added netdev_lock() call that is wrong ordered wrt RTNL, but the Fixes tag points to crit_lock being wrongly placed (by lockdep standards). Actual reason we got it wrong is dated back to critical section managed by pure flag checks, which is with us since the very beginning. [1] afc6649 ("eth: iavf: extend the netdev_lock usage") Fixes: 5ac49f3 ("iavf: use mutexes for locking of critical sections") Reviewed-by: Jacob Keller <[email protected]> Signed-off-by: Przemek Kitszel <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent b56bbaf commit dba35a4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5596,22 +5596,27 @@ static int iavf_suspend(struct device *dev_d)
55965596
{
55975597
struct net_device *netdev = dev_get_drvdata(dev_d);
55985598
struct iavf_adapter *adapter = netdev_priv(netdev);
5599+
bool running;
55995600

56005601
netif_device_detach(netdev);
56015602

5603+
running = netif_running(netdev);
5604+
if (running)
5605+
rtnl_lock();
5606+
56025607
netdev_lock(netdev);
56035608
mutex_lock(&adapter->crit_lock);
56045609

5605-
if (netif_running(netdev)) {
5606-
rtnl_lock();
5610+
if (running)
56075611
iavf_down(adapter);
5608-
rtnl_unlock();
5609-
}
5612+
56105613
iavf_free_misc_irq(adapter);
56115614
iavf_reset_interrupt_capability(adapter);
56125615

56135616
mutex_unlock(&adapter->crit_lock);
56145617
netdev_unlock(netdev);
5618+
if (running)
5619+
rtnl_unlock();
56155620

56165621
return 0;
56175622
}

0 commit comments

Comments
 (0)