From 0fa296dd520eb388e18b97dc553926f82a09cc1d Mon Sep 17 00:00:00 2001 From: Kuniyuki Iwashima Date: Fri, 3 Jul 2026 00:09:16 +0000 Subject: [PATCH] net: Hold __rtnl_net_lock() in netdev_wait_allrefs_any(). Currently, netdev_run_todo() processes pending devices from multiple namespaces in a batch. To expand the per-netns RTNL coverage for NETDEV_UNREGISTER, let's acquire __rtnl_net_lock() in netdev_wait_allrefs_any(). Note that netdev_run_todo() itself will need to be namespacified before RTNL is removed. Signed-off-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20260703001009.1572444-6-kuniyu@google.com Signed-off-by: Paolo Abeni --- net/core/dev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 9db053b355ef..cc77f41452ec 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -11613,8 +11613,13 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list) rtnl_lock(); /* Rebroadcast unregister notification */ - list_for_each_entry(dev, list, todo_list) + list_for_each_entry(dev, list, todo_list) { + struct net *net = dev_net(dev); + + __rtnl_net_lock(net); call_netdevice_notifiers(NETDEV_UNREGISTER, dev); + __rtnl_net_unlock(net); + } __rtnl_unlock(); rcu_barrier();