diff options
Diffstat (limited to 'kernel/nsproxy.c')
-rw-r--r-- | kernel/nsproxy.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 049e7c0ac566..ac99837e7a04 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -156,7 +156,14 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk) | |||
156 | goto out; | 156 | goto out; |
157 | } | 157 | } |
158 | 158 | ||
159 | err = ns_cgroup_clone(tsk); | ||
160 | if (err) { | ||
161 | put_nsproxy(new_ns); | ||
162 | goto out; | ||
163 | } | ||
164 | |||
159 | tsk->nsproxy = new_ns; | 165 | tsk->nsproxy = new_ns; |
166 | |||
160 | out: | 167 | out: |
161 | put_nsproxy(old_ns); | 168 | put_nsproxy(old_ns); |
162 | return err; | 169 | return err; |
@@ -196,8 +203,16 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags, | |||
196 | 203 | ||
197 | *new_nsp = create_new_namespaces(unshare_flags, current, | 204 | *new_nsp = create_new_namespaces(unshare_flags, current, |
198 | new_fs ? new_fs : current->fs); | 205 | new_fs ? new_fs : current->fs); |
199 | if (IS_ERR(*new_nsp)) | 206 | if (IS_ERR(*new_nsp)) { |
200 | err = PTR_ERR(*new_nsp); | 207 | err = PTR_ERR(*new_nsp); |
208 | goto out; | ||
209 | } | ||
210 | |||
211 | err = ns_cgroup_clone(current); | ||
212 | if (err) | ||
213 | put_nsproxy(*new_nsp); | ||
214 | |||
215 | out: | ||
201 | return err; | 216 | return err; |
202 | } | 217 | } |
203 | 218 | ||