Patch "dev: Acquire netdev_rename_lock before restoring dev->name in dev_change_name()." has been added to the 6.13-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

    dev: Acquire netdev_rename_lock before restoring dev->name in dev_change_name().

to the 6.13-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:
     dev-acquire-netdev_rename_lock-before-restoring-dev-.patch
and it can be found in the queue-6.13 subdirectory.

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



commit 3b5b229820385aaf738cb2ba260bfd21876776ae
Author: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
Date:   Wed Jan 15 18:55:43 2025 +0900

    dev: Acquire netdev_rename_lock before restoring dev->name in dev_change_name().
    
    [ Upstream commit e361560a7912958ba3059f51e7dd21612d119169 ]
    
    The cited commit forgot to add netdev_rename_lock in one of the
    error paths in dev_change_name().
    
    Let's hold netdev_rename_lock before restoring the old dev->name.
    
    Fixes: 0840556e5a3a ("net: Protect dev->name by seqlock.")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Link: https://patch.msgid.link/20250115095545.52709-2-kuniyu@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/dev.c b/net/core/dev.c
index a9f62f5aeb840..7600820bed6bd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1279,7 +1279,9 @@ int dev_change_name(struct net_device *dev, const char *newname)
 rollback:
 	ret = device_rename(&dev->dev, dev->name);
 	if (ret) {
+		write_seqlock_bh(&netdev_rename_lock);
 		memcpy(dev->name, oldname, IFNAMSIZ);
+		write_sequnlock_bh(&netdev_rename_lock);
 		WRITE_ONCE(dev->name_assign_type, old_assign_type);
 		up_write(&devnet_rename_sem);
 		return ret;




[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