]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ip6mr: Remove RTNL in ip6mr_rules_init() and ip6mr_net_init().
authorKuniyuki Iwashima <kuniyu@google.com>
Thu, 4 Jun 2026 22:46:31 +0000 (22:46 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Jun 2026 00:06:24 +0000 (17:06 -0700)
commit2290727b2fdb9f56f6fa2e06b4c5061c4f28e2df
tree7fc3912945c5f34c0e9983fb8cabd828a92b2f0b
parent2a798e8c71b569b3adca009ceb558ff2a936c4d9
ip6mr: Remove RTNL in ip6mr_rules_init() and ip6mr_net_init().

When ip6mr_free_table() is called from ip6mr_rules_init() or
ip6mr_net_init(), the netns is not yet published.

Thus, no device should have been registered, and
mroute_clean_tables() will not call mif6_delete(), so
unregister_netdevice_many() is unnecessary.

unregister_netdevice_many() does nothing if the list is empty,
but it requires RTNL due to the unconditional ASSERT_RTNL()
at the entry of unregister_netdevice_many_notify().

Let's remove unnecessary RTNL and ASSERT_RTNL() and instead
add WARN_ON_ONCE() in ip6mr_free_table().

Note that we use a local list for the new WARN_ON_ONCE() because
dev_kill_list passed from ip6mr_rules_exit_rtnl() may have some
devices when other ops->init() fails after ipmr durnig setup_net().

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260604224712.3209821-14-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/ip6mr.c