]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dsa: qca8k: Use nested lock to avoid splat
authorAndrew Lunn <andrew@lunn.ch>
Sun, 10 Nov 2024 17:59:55 +0000 (18:59 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 13 Nov 2024 02:25:30 +0000 (18:25 -0800)
qca8k_phy_eth_command() is used to probe the child MDIO bus while the
parent MDIO is locked. This causes lockdep splat, reporting a possible
deadlock. It is not an actually deadlock, because different locks are
used. By making use of mutex_lock_nested() we can avoid this false
positive.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241110175955.3053664-1-andrew@lunn.ch
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/qca/qca8k-8xxx.c

index f8d8c70642c4ff36023eac9ad8be5ada8db2f4cc..59b4a7240b583227e62a8798bc991b725ae54a47 100644 (file)
@@ -673,7 +673,7 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy,
         * We therefore need to lock the MDIO bus onto which the switch is
         * connected.
         */
-       mutex_lock(&priv->bus->mdio_lock);
+       mutex_lock_nested(&priv->bus->mdio_lock, MDIO_MUTEX_NESTED);
 
        /* Actually start the request:
         * 1. Send mdio master packet