net: sh_eth: Fix missing rtnl lock in suspend/resume path

[ Upstream commit b95102215a8d0987789715ce11c0d4ec031cbfbe ]

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: b71af04676 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Kory Maincent
2025-01-29 10:50:47 +01:00
committed by Greg Kroah-Hartman
parent d51d31057c
commit ff93e43a34

View File

@@ -3473,10 +3473,12 @@ static int sh_eth_suspend(struct device *dev)
netif_device_detach(ndev); netif_device_detach(ndev);
rtnl_lock();
if (mdp->wol_enabled) if (mdp->wol_enabled)
ret = sh_eth_wol_setup(ndev); ret = sh_eth_wol_setup(ndev);
else else
ret = sh_eth_close(ndev); ret = sh_eth_close(ndev);
rtnl_unlock();
return ret; return ret;
} }
@@ -3490,10 +3492,12 @@ static int sh_eth_resume(struct device *dev)
if (!netif_running(ndev)) if (!netif_running(ndev))
return 0; return 0;
rtnl_lock();
if (mdp->wol_enabled) if (mdp->wol_enabled)
ret = sh_eth_wol_restore(ndev); ret = sh_eth_wol_restore(ndev);
else else
ret = sh_eth_open(ndev); ret = sh_eth_open(ndev);
rtnl_unlock();
if (ret < 0) if (ret < 0)
return ret; return ret;