diff options
| author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2025-04-01 12:07:08 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:44:41 +0200 |
| commit | ed546836fc103fb8b168726a9aa32dab3b539e09 (patch) | |
| tree | a0bb947daab04e64afadb98493e12a2ebe327a40 | |
| parent | 46c1e23e34c9d1eaadf37f88216d9d8ce0d0bcee (diff) | |
| download | linux-ed546836fc103fb8b168726a9aa32dab3b539e09.tar.gz linux-ed546836fc103fb8b168726a9aa32dab3b539e09.tar.bz2 linux-ed546836fc103fb8b168726a9aa32dab3b539e09.zip | |
rtnetlink: Use register_pernet_subsys() in rtnl_net_debug_init().
[ Upstream commit 1b7fdc702c031134c619b74c4f311c590e50ca3d ]
rtnl_net_debug_init() registers rtnl_net_debug_net_ops by
register_pernet_device() but calls unregister_pernet_subsys()
in case register_netdevice_notifier() fails.
It corrupts pernet_list because first_device is updated in
register_pernet_device() but not unregister_pernet_subsys().
Let's fix it by calling register_pernet_subsys() instead.
The _subsys() one fits better for the use case because it keeps
the notifier alive until default_device_exit_net(), giving it
more chance to test NETDEV_UNREGISTER.
Fixes: 03fa53485659 ("rtnetlink: Add ASSERT_RTNL_NET() placeholder for netdev notifier.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250401190716.70437-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | net/core/rtnl_net_debug.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/rtnl_net_debug.c b/net/core/rtnl_net_debug.c index 7ecd28cc1c22..f3272b09c255 100644 --- a/net/core/rtnl_net_debug.c +++ b/net/core/rtnl_net_debug.c @@ -102,7 +102,7 @@ static int __init rtnl_net_debug_init(void) { int ret; - ret = register_pernet_device(&rtnl_net_debug_net_ops); + ret = register_pernet_subsys(&rtnl_net_debug_net_ops); if (ret) return ret; |
