From: Eric Dumazet Date: Mon, 25 May 2026 08:35:39 +0000 (+0000) Subject: net: defer netdev_name_node_alt_flush() call to netdev_run_todo() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00888feb601497a58ed363aae13be01b55d8a028;p=thirdparty%2Flinux.git net: defer netdev_name_node_alt_flush() call to netdev_run_todo() 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 Reviewed-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20260525083542.1565964-3-edumazet@google.com Signed-off-by: Jakub Kicinski --- diff --git a/net/core/dev.c b/net/core/dev.c index a50cd68c6bfa..804e8ad25010 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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);