Skip to content

Commit 3effcc0

Browse files
author
Paolo Abeni
committed
Merge branch 'fix-missing-rtnl-lock-in-suspend-path'
Kory Maincent says: ==================== Fix missing rtnl lock in suspend path Fix the suspend path by ensuring the rtnl lock is held where required. Calls to open, close and WOL operations must be performed under the rtnl lock to prevent conflicts with ongoing ndo operations. Discussion about this issue can be found here: https://lore.kernel.org/netdev/[email protected]/ While working on the ravb fix, it was discovered that the sh_eth driver has the same issue. This patch series addresses both drivers. I do not have access to hardware for either of these MACs, so it would be great if maintainers or others with the relevant boards could test these fixes. v2: https://lore.kernel.org/r/20250123-fix_missing_rtnl_lock_phy_disconnect-v2-0-e6206f5508ba@bootlin.com v1: https://lore.kernel.org/r/20250122-fix_missing_rtnl_lock_phy_disconnect-v1-0-8cb9f6f88fd1@bootlin.com Signed-off-by: Kory Maincent <[email protected]> ==================== Link: https://patch.msgid.link/20250129-fix_missing_rtnl_lock_phy_disconnect-v3-0-24c4ba185a92@bootlin.com Signed-off-by: Paolo Abeni <[email protected]>
2 parents da5ca22 + b951022 commit 3effcc0

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,10 +3217,15 @@ static int ravb_suspend(struct device *dev)
32173217

32183218
netif_device_detach(ndev);
32193219

3220-
if (priv->wol_enabled)
3221-
return ravb_wol_setup(ndev);
3220+
rtnl_lock();
3221+
if (priv->wol_enabled) {
3222+
ret = ravb_wol_setup(ndev);
3223+
rtnl_unlock();
3224+
return ret;
3225+
}
32223226

32233227
ret = ravb_close(ndev);
3228+
rtnl_unlock();
32243229
if (ret)
32253230
return ret;
32263231

@@ -3245,19 +3250,20 @@ static int ravb_resume(struct device *dev)
32453250
if (!netif_running(ndev))
32463251
return 0;
32473252

3253+
rtnl_lock();
32483254
/* If WoL is enabled restore the interface. */
3249-
if (priv->wol_enabled) {
3255+
if (priv->wol_enabled)
32503256
ret = ravb_wol_restore(ndev);
3251-
if (ret)
3252-
return ret;
3253-
} else {
3257+
else
32543258
ret = pm_runtime_force_resume(dev);
3255-
if (ret)
3256-
return ret;
3259+
if (ret) {
3260+
rtnl_unlock();
3261+
return ret;
32573262
}
32583263

32593264
/* Reopening the interface will restore the device to the working state. */
32603265
ret = ravb_open(ndev);
3266+
rtnl_unlock();
32613267
if (ret < 0)
32623268
goto out_rpm_put;
32633269

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3494,10 +3494,12 @@ static int sh_eth_suspend(struct device *dev)
34943494

34953495
netif_device_detach(ndev);
34963496

3497+
rtnl_lock();
34973498
if (mdp->wol_enabled)
34983499
ret = sh_eth_wol_setup(ndev);
34993500
else
35003501
ret = sh_eth_close(ndev);
3502+
rtnl_unlock();
35013503

35023504
return ret;
35033505
}
@@ -3511,10 +3513,12 @@ static int sh_eth_resume(struct device *dev)
35113513
if (!netif_running(ndev))
35123514
return 0;
35133515

3516+
rtnl_lock();
35143517
if (mdp->wol_enabled)
35153518
ret = sh_eth_wol_restore(ndev);
35163519
else
35173520
ret = sh_eth_open(ndev);
3521+
rtnl_unlock();
35183522

35193523
if (ret < 0)
35203524
return ret;

0 commit comments

Comments
 (0)