Skip to content

Commit 19e13cb

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Hold rtnl lock in suspend/resume callbacks
We need to hold rnl lock in suspend and resume callbacks because phylink requires it. Otherwise we will get a WARN() in suspend and resume. Also, move phylink start and stop callbacks to inside device's internal lock so that we prevent concurrent HW accesses. Fixes: 7437127 ("net: stmmac: Convert to phylink and remove phylib logic") Reported-by: Christophe ROULLIER <christophe.roullier@st.com> Tested-by: Christophe ROULLIER <christophe.roullier@st.com> Signed-off-by: Jose Abreu <joabreu@synopsys.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 28e4860 commit 19e13cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4451,10 +4451,12 @@ int stmmac_suspend(struct device *dev)
44514451
if (!ndev || !netif_running(ndev))
44524452
return 0;
44534453

4454-
phylink_stop(priv->phylink);
4455-
44564454
mutex_lock(&priv->lock);
44574455

4456+
rtnl_lock();
4457+
phylink_stop(priv->phylink);
4458+
rtnl_unlock();
4459+
44584460
netif_device_detach(ndev);
44594461
stmmac_stop_all_queues(priv);
44604462

@@ -4558,9 +4560,11 @@ int stmmac_resume(struct device *dev)
45584560

45594561
stmmac_start_all_queues(priv);
45604562

4561-
mutex_unlock(&priv->lock);
4562-
4563+
rtnl_lock();
45634564
phylink_start(priv->phylink);
4565+
rtnl_unlock();
4566+
4567+
mutex_unlock(&priv->lock);
45644568

45654569
return 0;
45664570
}

0 commit comments

Comments
 (0)