From: Kuniyuki Iwashima Date: Wed, 31 Jul 2024 20:07:19 +0000 (-0700) Subject: net: Call preinit_net() without pernet_ops_rwsem. X-Git-Tag: v6.12-rc1~232^2~321^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=930299491825575503ec411ff28473aaa6b8c9ca;p=thirdparty%2Fkernel%2Flinux.git net: Call preinit_net() without pernet_ops_rwsem. When initialising the root netns, we call preinit_net() under pernet_ops_rwsem. However, the operations in preinit_net() do not require pernet_ops_rwsem. Also, we don't hold it for preinit_net() when initialising non-root netns. To be consistent, let's call preinit_net() without pernet_ops_rwsem in net_ns_init(). Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller --- diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 6c9acb0868529..b91c15b27fb20 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -1199,8 +1199,9 @@ void __init net_ns_init(void) #ifdef CONFIG_KEYS init_net.key_domain = &init_net_key_domain; #endif - down_write(&pernet_ops_rwsem); preinit_net(&init_net); + + down_write(&pernet_ops_rwsem); if (setup_net(&init_net, &init_user_ns)) panic("Could not setup the initial network namespace");