Patch "net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-dsa-mt7530-fix-kernel-bug-in-mdiobus_free-when-u.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f86986b084c7534aea3fd9ffbf4b4921574ea039
Author: Vladimir Oltean <vladimir.oltean@xxxxxxx>
Date:   Mon Feb 7 18:15:52 2022 +0200

    net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding
    
    [ Upstream commit 9ffe3d09e32da45bb5a29cf2e80ec8d7534010c5 ]
    
    Nobody in this driver calls mdiobus_unregister(), which is necessary if
    mdiobus_register() completes successfully. So if the devres callbacks
    that free the mdiobus get invoked (this is the case when unbinding the
    driver), mdiobus_free() will BUG if the mdiobus is still registered,
    which it is.
    
    My speculation is that this is due to the fact that prior to commit
    ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()")
    from June 2020, _devm_mdiobus_free() used to call mdiobus_unregister().
    But at the time that the mt7530 support was introduced in May 2021, the
    API was already changed. It's therefore likely that the blamed patch was
    developed on an older tree, and incorrectly adapted to net-next. This
    makes the Fixes: tag correct.
    
    Fix the problem by using the devres variant of mdiobus_register.
    
    Fixes: ba751e28d442 ("net: dsa: mt7530: add interrupt support")
    Signed-off-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>
    Reviewed-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 9890672a206d0..fb59efc7f9266 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -2066,7 +2066,7 @@ mt7530_setup_mdio(struct mt7530_priv *priv)
 	if (priv->irq)
 		mt7530_setup_mdio_irq(priv);
 
-	ret = mdiobus_register(bus);
+	ret = devm_mdiobus_register(dev, bus);
 	if (ret) {
 		dev_err(dev, "failed to register MDIO bus: %d\n", ret);
 		if (priv->irq)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux