|
@@ -303,6 +303,9 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
|
|
if (error < 0)
|
|
if (error < 0)
|
|
goto out_undo;
|
|
goto out_undo;
|
|
}
|
|
}
|
|
|
|
+ rtnl_lock();
|
|
|
|
+ list_add_tail_rcu(&net->list, &net_namespace_list);
|
|
|
|
+ rtnl_unlock();
|
|
out:
|
|
out:
|
|
return error;
|
|
return error;
|
|
|
|
|
|
@@ -424,11 +427,6 @@ struct net *copy_net_ns(unsigned long flags,
|
|
|
|
|
|
net->ucounts = ucounts;
|
|
net->ucounts = ucounts;
|
|
rv = setup_net(net, user_ns);
|
|
rv = setup_net(net, user_ns);
|
|
- if (rv == 0) {
|
|
|
|
- rtnl_lock();
|
|
|
|
- list_add_tail_rcu(&net->list, &net_namespace_list);
|
|
|
|
- rtnl_unlock();
|
|
|
|
- }
|
|
|
|
mutex_unlock(&net_mutex);
|
|
mutex_unlock(&net_mutex);
|
|
if (rv < 0) {
|
|
if (rv < 0) {
|
|
dec_net_namespaces(ucounts);
|
|
dec_net_namespaces(ucounts);
|
|
@@ -880,11 +878,6 @@ static int __init net_ns_init(void)
|
|
panic("Could not setup the initial network namespace");
|
|
panic("Could not setup the initial network namespace");
|
|
|
|
|
|
init_net_initialized = true;
|
|
init_net_initialized = true;
|
|
-
|
|
|
|
- rtnl_lock();
|
|
|
|
- list_add_tail_rcu(&init_net.list, &net_namespace_list);
|
|
|
|
- rtnl_unlock();
|
|
|
|
-
|
|
|
|
mutex_unlock(&net_mutex);
|
|
mutex_unlock(&net_mutex);
|
|
|
|
|
|
register_pernet_subsys(&net_ns_ops);
|
|
register_pernet_subsys(&net_ns_ops);
|