Patch "mctp: Remove device type check at unregister" has been added to the 6.0-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

    mctp: Remove device type check at unregister

to the 6.0-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:
     mctp-remove-device-type-check-at-unregister.patch
and it can be found in the queue-6.0 subdirectory.

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



commit e17f34c557bc9517764426ac33363a70363e74a5
Author: Matt Johnston <matt@xxxxxxxxxxxxxxxxxxxx>
Date:   Thu Dec 15 13:49:33 2022 +0800

    mctp: Remove device type check at unregister
    
    [ Upstream commit b389a902dd5be4ece505a2e0463b9b034de04bf5 ]
    
    The unregister check could be incorrectly triggered if a netdev
    changes its type after register. That is possible for a tun device
    using TUNSETLINK ioctl, resulting in mctp unregister failing
    and the netdev unregister waiting forever.
    
    This was encountered by https://github.com/openthread/openthread/issues/8523
    
    Neither check at register or unregister is required. They were added in
    an attempt to track down mctp_ptr being set unexpectedly, which should
    not happen in normal operation.
    
    Fixes: 7b1871af75f3 ("mctp: Warn if pointer is set for a wrong dev type")
    Signed-off-by: Matt Johnston <matt@xxxxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221215054933.2403401-1-matt@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mctp/device.c b/net/mctp/device.c
index 99a3bda8852f..acb97b257428 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -429,12 +429,6 @@ static void mctp_unregister(struct net_device *dev)
 	struct mctp_dev *mdev;
 
 	mdev = mctp_dev_get_rtnl(dev);
-	if (mdev && !mctp_known(dev)) {
-		// Sanity check, should match what was set in mctp_register
-		netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d",
-			    __func__, dev->type);
-		return;
-	}
 	if (!mdev)
 		return;
 
@@ -451,14 +445,8 @@ static int mctp_register(struct net_device *dev)
 	struct mctp_dev *mdev;
 
 	/* Already registered? */
-	mdev = rtnl_dereference(dev->mctp_ptr);
-
-	if (mdev) {
-		if (!mctp_known(dev))
-			netdev_warn(dev, "%s: BUG mctp_ptr set for unknown type %d",
-				    __func__, dev->type);
+	if (rtnl_dereference(dev->mctp_ptr))
 		return 0;
-	}
 
 	/* only register specific types */
 	if (!mctp_known(dev))



[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