Skip to content

Commit f7bf6ee

Browse files
committed
iavf: iavf_suspend(): take RTNL before netdev_lock()
JIRA: https://issues.redhat.com/browse/RHEL-87382 commit dba35a4 Author: Przemek Kitszel <przemyslaw.kitszel@intel.com> Date: Fri Apr 4 12:23:16 2025 +0200 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 <jacob.e.keller@intel.com> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Tested-by: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Mohammad Heib <mheib@redhat.com>
1 parent 645a1aa commit f7bf6ee

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
@@ -5611,22 +5611,27 @@ static int iavf_suspend(struct device *dev_d)
56115611
{
56125612
struct net_device *netdev = dev_get_drvdata(dev_d);
56135613
struct iavf_adapter *adapter = netdev_priv(netdev);
5614+
bool running;
56145615

56155616
netif_device_detach(netdev);
56165617

5618+
running = netif_running(netdev);
5619+
if (running)
5620+
rtnl_lock();
5621+
56175622
netdev_lock(netdev);
56185623
mutex_lock(&adapter->crit_lock);
56195624

5620-
if (netif_running(netdev)) {
5621-
rtnl_lock();
5625+
if (running)
56225626
iavf_down(adapter);
5623-
rtnl_unlock();
5624-
}
5627+
56255628
iavf_free_misc_irq(adapter);
56265629
iavf_reset_interrupt_capability(adapter);
56275630

56285631
mutex_unlock(&adapter->crit_lock);
56295632
netdev_unlock(netdev);
5633+
if (running)
5634+
rtnl_unlock();
56305635

56315636
return 0;
56325637
}

0 commit comments

Comments
 (0)