Skip to content

Commit b951022

Browse files
kmaincentPaolo Abeni
authored andcommitted
net: sh_eth: Fix missing rtnl lock in suspend/resume path
Fix the suspend/resume path by ensuring the rtnl lock is held where required. Calls to sh_eth_close, sh_eth_open and wol operations must be performed under the rtnl lock to prevent conflicts with ongoing ndo operations. Fixes: b71af04 ("sh_eth: add more PM methods") Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 2c2ebb2 commit b951022

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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)