Skip to content

Commit 9302994

Browse files
q2vendavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2b5afc1 commit 9302994

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/core/net_namespace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,8 +1199,9 @@ void __init net_ns_init(void)
11991199
#ifdef CONFIG_KEYS
12001200
init_net.key_domain = &init_net_key_domain;
12011201
#endif
1202-
down_write(&pernet_ops_rwsem);
12031202
preinit_net(&init_net);
1203+
1204+
down_write(&pernet_ops_rwsem);
12041205
if (setup_net(&init_net, &init_user_ns))
12051206
panic("Could not setup the initial network namespace");
12061207

0 commit comments

Comments
 (0)