提交 6e2b0eb4 编写于 作者: Z Zong Li 提交者: Wang ShaoBo

net: macb: ensure the device is available before accessing GEMGXL control registers

stable inclusion
from stable-v5.10.44
commit a385cbf31ed0deceb2e09c3950b605f94c9a4f0a
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=432
CVE: NA

-------------------------------------------------

[ Upstream commit 5eff1461 ]

If runtime power menagement is enabled, the gigabit ethernet PLL would
be disabled after macb_probe(). During this period of time, the system
would hang up if we try to access GEMGXL control registers.

We can't put runtime_pm_get/runtime_pm_put/ there due to the issue of
sleep inside atomic section (7fa2955f ("sh_eth: Fix sleeping
function called from invalid context"). Add netif_running checking to
ensure the device is available before accessing GEMGXL device.

Changed in v2:
 - Use netif_running instead of its own flag
Signed-off-by: NZong Li <zong.li@sifive.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: N505157141 <505157141@qq.com>
Reviewed-by: NJian Cheng <cj.chengjian@huawei.com>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 70f076c9
...@@ -2709,6 +2709,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) ...@@ -2709,6 +2709,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp)
struct gem_stats *hwstat = &bp->hw_stats.gem; struct gem_stats *hwstat = &bp->hw_stats.gem;
struct net_device_stats *nstat = &bp->dev->stats; struct net_device_stats *nstat = &bp->dev->stats;
if (!netif_running(bp->dev))
return nstat;
gem_update_stats(bp); gem_update_stats(bp);
nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors + nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册