diff options
Diffstat (limited to 'kernel/nsproxy.c')
-rw-r--r-- | kernel/nsproxy.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 7f8b051fc19f..a214e0e9035f 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -122,6 +122,7 @@ out_ns: | |||
122 | int copy_namespaces(unsigned long flags, struct task_struct *tsk) | 122 | int copy_namespaces(unsigned long flags, struct task_struct *tsk) |
123 | { | 123 | { |
124 | struct nsproxy *old_ns = tsk->nsproxy; | 124 | struct nsproxy *old_ns = tsk->nsproxy; |
125 | struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns); | ||
125 | struct nsproxy *new_ns; | 126 | struct nsproxy *new_ns; |
126 | int err = 0; | 127 | int err = 0; |
127 | 128 | ||
@@ -134,7 +135,7 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk) | |||
134 | CLONE_NEWPID | CLONE_NEWNET))) | 135 | CLONE_NEWPID | CLONE_NEWNET))) |
135 | return 0; | 136 | return 0; |
136 | 137 | ||
137 | if (!capable(CAP_SYS_ADMIN)) { | 138 | if (!ns_capable(user_ns, CAP_SYS_ADMIN)) { |
138 | err = -EPERM; | 139 | err = -EPERM; |
139 | goto out; | 140 | goto out; |
140 | } | 141 | } |
@@ -191,7 +192,7 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags, | |||
191 | CLONE_NEWNET | CLONE_NEWPID))) | 192 | CLONE_NEWNET | CLONE_NEWPID))) |
192 | return 0; | 193 | return 0; |
193 | 194 | ||
194 | if (!capable(CAP_SYS_ADMIN)) | 195 | if (!nsown_capable(CAP_SYS_ADMIN)) |
195 | return -EPERM; | 196 | return -EPERM; |
196 | 197 | ||
197 | *new_nsp = create_new_namespaces(unshare_flags, current, | 198 | *new_nsp = create_new_namespaces(unshare_flags, current, |