From: Meng Li <Meng.Li@windriver.com>
To: stable@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
mcoquelin.stm32@gmail.com, linux@armlinux.org.uk, andrew@lunn.ch,
qiangqing.zhang@nxp.com
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
meng.li@windriver.com
Subject: [PATCH 4/6] net: stmmac: fix system hang if change mac address after interface ifdown
Date: Fri, 19 Nov 2021 10:53:57 +0800 [thread overview]
Message-ID: <20211119025359.30815-5-Meng.Li@windriver.com> (raw)
In-Reply-To: <20211119025359.30815-1-Meng.Li@windriver.com>
From: Joakim Zhang <qiangqing.zhang@nxp.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@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Meng Li <Meng.Li@windriver.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
next prev parent reply other threads:[~2021-11-19 2:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 2:53 [PATCH 0/6] backport patches to improve clocks management for stmmac driver Meng Li
2021-11-19 2:53 ` [PATCH 1/6] net: stmmac: add clocks management for gmac driver Meng Li
2021-11-19 2:53 ` [PATCH 2/6] net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP Meng Li
2021-11-19 2:53 ` [PATCH 3/6] net: stmmac: fix missing unlock on error in stmmac_suspend() Meng Li
2021-11-19 2:53 ` Meng Li [this message]
2021-11-19 2:53 ` [PATCH 5/6] net: stmmac: fix issue where clk is being unprepared twice Meng Li
2021-11-19 2:53 ` [PATCH 6/6] net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings Meng Li
2021-11-19 13:29 ` [PATCH 0/6] backport patches to improve clocks management for stmmac driver Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211119025359.30815-5-Meng.Li@windriver.com \
--to=meng.li@windriver.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=qiangqing.zhang@nxp.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).