mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 09:20:13 -04:00
net: Wrap default_device_exit_net() with __rtnl_net_lock().
default_device_exit_net() could call dev_change_net_namespace() to move devices from a dying netns to init_net. Let's hold the two netns __rtnl_net_lock() around it. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-5-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
c6cfaf9783
commit
2b12ec2578
@@ -13039,7 +13039,7 @@ static void __net_exit default_device_exit_net(struct net *net)
|
||||
* Push all migratable network devices back to the
|
||||
* initial network namespace
|
||||
*/
|
||||
ASSERT_RTNL();
|
||||
|
||||
for_each_netdev_safe(net, dev, aux) {
|
||||
int err;
|
||||
char fb_name[IFNAMSIZ];
|
||||
@@ -13082,11 +13082,19 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list)
|
||||
LIST_HEAD(dev_kill_list);
|
||||
|
||||
rtnl_lock();
|
||||
|
||||
__rtnl_net_lock(&init_net);
|
||||
|
||||
list_for_each_entry(net, net_list, exit_list) {
|
||||
__rtnl_net_lock(net);
|
||||
default_device_exit_net(net);
|
||||
__rtnl_net_unlock(net);
|
||||
|
||||
cond_resched();
|
||||
}
|
||||
|
||||
__rtnl_net_unlock(&init_net);
|
||||
|
||||
list_for_each_entry(net, net_list, exit_list) {
|
||||
for_each_netdev_reverse(net, dev) {
|
||||
if (dev->rtnl_link_ops && dev->rtnl_link_ops->dellink)
|
||||
|
||||
Reference in New Issue
Block a user