]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: sh_eth: Fix missing rtnl lock in suspend/resume path
authorKory Maincent <kory.maincent@bootlin.com>
Wed, 29 Jan 2025 09:50:47 +0000 (10:50 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 30 Jan 2025 10:23:01 +0000 (11:23 +0100)
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: b71af04676e9 ("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>
drivers/net/ethernet/renesas/sh_eth.c

index 8887b89210093b49673f9b58ffc2998d4e93d36d..5fc8027c92c7c95bd4e2bd586b996fe1ec1010b7 100644 (file)
@@ -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;
 }
@@ -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;