[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240516230151.1031190-2-opendmb@gmail.com>
Date: Thu, 16 May 2024 16:01:49 -0700
From: Doug Berger <opendmb@...il.com>
To: stable@...r.kernel.org
Cc: Doug Berger <opendmb@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
bcm-kernel-feedback-list@...adcom.com,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Florian Fainelli <florian.fainelli@...adcom.com>
Subject: [PATCH stable 5.4 1/3] net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access
[ Upstream commit d85cf67a339685beae1d0aee27b7f61da95455be ]
The EXT_RGMII_OOB_CTRL register can be written from different
contexts. It is predominantly written from the adjust_link
handler which is synchronized by the phydev->lock, but can
also be written from a different context when configuring the
mii in bcmgenet_mii_config().
The chances of contention are quite low, but it is conceivable
that adjust_link could occur during resume when WoL is enabled
so use the phydev->lock synchronizer in bcmgenet_mii_config()
to be sure.
Fixes: afe3f907d20f ("net: bcmgenet: power on MII block for all MII modes")
Cc: stable@...r.kernel.org
Signed-off-by: Doug Berger <opendmb@...il.com>
Acked-by: Florian Fainelli <florian.fainelli@...adcom.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 56fad34461f7..d0b59d1f6c73 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -269,6 +269,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
* block for the interface to work
*/
if (priv->ext_phy) {
+ mutex_lock(&phydev->lock);
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
reg |= id_mode_dis;
if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
@@ -276,6 +277,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
else
reg |= RGMII_MODE_EN;
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
+ mutex_unlock(&phydev->lock);
}
if (init)
--
2.34.1
Powered by blists - more mailing lists