diff options
| author | Kuniyuki Iwashima <[email protected]> | 2025-01-15 09:55:45 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-01-17 01:20:50 +0000 |
| commit | be94cfdb993ff091ce3b98a16b45795198957f95 (patch) | |
| tree | fb21e89872604ac996af35b011eb1aaa7ee882f9 /net/core/dev.c | |
| parent | dev: Remove devnet_rename_sem. (diff) | |
| download | kernel-be94cfdb993ff091ce3b98a16b45795198957f95.tar.gz kernel-be94cfdb993ff091ce3b98a16b45795198957f95.zip | |
dev: Hold rtnl_net_lock() for dev_ifsioc().
Basically, dev_ifsioc() operates on the passed single netns (except
for netdev notifier chains with lower/upper devices for which we will
need more changes).
Let's hold rtnl_net_lock() for dev_ifsioc().
Now that NETDEV_CHANGENAME is always triggered under rtnl_net_lock()
of the device's netns. (do_setlink() and dev_ifsioc())
Signed-off-by: Kuniyuki Iwashima <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 32fcf54b779d..fe5f5855593d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1348,16 +1348,13 @@ static int dev_get_valid_name(struct net *net, struct net_device *dev, */ int dev_change_name(struct net_device *dev, const char *newname) { + struct net *net = dev_net(dev); unsigned char old_assign_type; char oldname[IFNAMSIZ]; int err = 0; int ret; - struct net *net; - - ASSERT_RTNL(); - BUG_ON(!dev_net(dev)); - net = dev_net(dev); + ASSERT_RTNL_NET(net); if (!strncmp(newname, dev->name, IFNAMSIZ)) return 0; |
