Skip to content

Commit ac4bb99

Browse files
Joakim Zhanggregkh
authored andcommitted
net: stmmac: fix system hang if change mac address after interface ifdown
commit 4691ffb upstream. Fix system hang with below sequences: ~# ifconfig ethx down ~# ifconfig ethx hw ether xx:xx:xx:xx:xx:xx After ethx down, stmmac all clocks gated off and then register access causes system hang. Fixes: 5ec5582 ("net: stmmac: add clocks management for gmac driver") Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Meng Li <Meng.Li@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bcf3752 commit ac4bb99

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4324,12 +4324,21 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr)
43244324
struct stmmac_priv *priv = netdev_priv(ndev);
43254325
int ret = 0;
43264326

4327+
ret = pm_runtime_get_sync(priv->device);
4328+
if (ret < 0) {
4329+
pm_runtime_put_noidle(priv->device);
4330+
return ret;
4331+
}
4332+
43274333
ret = eth_mac_addr(ndev, addr);
43284334
if (ret)
4329-
return ret;
4335+
goto set_mac_error;
43304336

43314337
stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0);
43324338

4339+
set_mac_error:
4340+
pm_runtime_put(priv->device);
4341+
43334342
return ret;
43344343
}
43354344

0 commit comments

Comments
 (0)