mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
dev: Acquire netdev_rename_lock before restoring dev->name in dev_change_name().
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: 0840556e5a ("net: Protect dev->name by seqlock.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250115095545.52709-2-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8d20dcda40
commit
e361560a79
|
|
@ -1389,7 +1389,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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user