[PATCH net 1/4] net: b44: keep phylib ioctls outside the spinlock

From
James Hilliard <james.hilliard1@gmail.com>
Date
2026-11-13 08:49:15
Also in
lkml
Reply to
James Hilliard, 2026-11-13
b44_ioctl() holds bp->lock with interrupts disabled while calling
phy_mii_ioctl() for an external PHY. That helper takes sleeping MDIO
mutexes and can wait for a PHY reset to complete.

Keep the spinlock around the legacy internal-PHY ioctl only. External
PHY register accesses are serialized by the MDIO bus mutex, as they
already are when called from the PHY state machine.

Fixes: 86f4ea63e696 ("b44: add phylib support")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/net/ethernet/broadcom/b44.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index f994636fbd5f..e9f116dfaad9 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2126,14 +2126,14 @@ static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	if (!netif_running(dev))
 		goto out;
 
-	spin_lock_irq(&bp->lock);
 	if (bp->flags & B44_FLAG_EXTERNAL_PHY) {
 		BUG_ON(!dev->phydev);
 		err = phy_mii_ioctl(dev->phydev, ifr, cmd);
 	} else {
+		spin_lock_irq(&bp->lock);
 		err = generic_mii_ioctl(&bp->mii_if, if_mii(ifr), cmd, NULL);
+		spin_unlock_irq(&bp->lock);
 	}
-	spin_unlock_irq(&bp->lock);
 out:
 	return err;
 }
-- 
2.53.0
Thread (10 messages) 10 messages, 3 authors, last reply 3d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help