]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: defer netdev_name_node_alt_flush() call to netdev_run_todo()
authorEric Dumazet <edumazet@google.com>
Mon, 25 May 2026 08:35:39 +0000 (08:35 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 27 May 2026 02:20:15 +0000 (19:20 -0700)
In the following patch, we want to call rtnl_fill_prop_list() without
RTNL being held, but after a device reference was taken.

We need to free altnames in netdev_run_todo() instead of
unregister_netdevice_many_notify().

Freeing will only happen once all device references
have been released.

Note that dev->name_node serves as the anchor for altnames,
thus must be also freed in netdev_run_todo().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260525083542.1565964-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c

index a50cd68c6bfa21ddade57c13bf7942892bf99a2c..804e8ad25010ea66a5ddb2777c3ed09ee545dc1f 100644 (file)
@@ -11730,6 +11730,8 @@ void netdev_run_todo(void)
                WARN_ON(rcu_access_pointer(dev->ip_ptr));
                WARN_ON(rcu_access_pointer(dev->ip6_ptr));
 
+               netdev_name_node_alt_flush(dev);
+               netdev_name_node_free(dev->name_node);
                netdev_do_free_pcpu_stats(dev);
                if (dev->priv_destructor)
                        dev->priv_destructor(dev);
@@ -12443,8 +12445,6 @@ void unregister_netdevice_many_notify(struct list_head *head,
                dev_uc_flush(dev);
                dev_mc_flush(dev);
 
-               netdev_name_node_alt_flush(dev);
-               netdev_name_node_free(dev->name_node);
 
                netdev_rss_contexts_free(dev);