Skip to content

Commit

Permalink
net: sh_eth: Fix missing rtnl lock in suspend/resume path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kory Maincent authored and Paolo Abeni committed Jan 30, 2025
1 parent 2c2ebb2 commit b951022
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -3494,10 +3494,12 @@ static int sh_eth_suspend(struct device *dev)

netif_device_detach(ndev);

rtnl_lock();
if (mdp->wol_enabled)
ret = sh_eth_wol_setup(ndev);
else
ret = sh_eth_close(ndev);
rtnl_unlock();

return ret;
}
Expand All @@ -3511,10 +3513,12 @@ static int sh_eth_resume(struct device *dev)
if (!netif_running(ndev))
return 0;

rtnl_lock();
if (mdp->wol_enabled)
ret = sh_eth_wol_restore(ndev);
else
ret = sh_eth_open(ndev);
rtnl_unlock();

if (ret < 0)
return ret;
Expand Down

0 comments on commit b951022

Please sign in to comment.