[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211119025359.30815-5-Meng.Li@windriver.com>
Date: Fri, 19 Nov 2021 10:53:57 +0800
From: Meng Li <Meng.Li@...driver.com>
To: stable@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
mcoquelin.stm32@...il.com, linux@...linux.org.uk, andrew@...n.ch,
qiangqing.zhang@....com
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
meng.li@...driver.com
Subject: [PATCH 4/6] net: stmmac: fix system hang if change mac address after interface ifdown
From: Joakim Zhang <qiangqing.zhang@....com>
commit 4691ffb18ac908609aab07d13af7995b6b89d33c 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: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Signed-off-by: Joakim Zhang <qiangqing.zhang@....com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Meng Li <Meng.Li@...driver.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 51626edc6a4c..cccf98f66ff4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4324,12 +4324,21 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr)
struct stmmac_priv *priv = netdev_priv(ndev);
int ret = 0;
+ ret = pm_runtime_get_sync(priv->device);
+ if (ret < 0) {
+ pm_runtime_put_noidle(priv->device);
+ return ret;
+ }
+
ret = eth_mac_addr(ndev, addr);
if (ret)
- return ret;
+ goto set_mac_error;
stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0);
+set_mac_error:
+ pm_runtime_put(priv->device);
+
return ret;
}
--
2.17.1
Powered by blists - more mailing lists