diff options
Diffstat (limited to 'kernel/nsproxy.c')
-rw-r--r-- | kernel/nsproxy.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 5aa28e219487..15a6015a849d 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -58,30 +58,41 @@ static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk, | |||
58 | struct fs_struct *new_fs) | 58 | struct fs_struct *new_fs) |
59 | { | 59 | { |
60 | struct nsproxy *new_nsp; | 60 | struct nsproxy *new_nsp; |
61 | int err; | ||
61 | 62 | ||
62 | new_nsp = clone_nsproxy(tsk->nsproxy); | 63 | new_nsp = clone_nsproxy(tsk->nsproxy); |
63 | if (!new_nsp) | 64 | if (!new_nsp) |
64 | return ERR_PTR(-ENOMEM); | 65 | return ERR_PTR(-ENOMEM); |
65 | 66 | ||
66 | new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs); | 67 | new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs); |
67 | if (IS_ERR(new_nsp->mnt_ns)) | 68 | if (IS_ERR(new_nsp->mnt_ns)) { |
69 | err = PTR_ERR(new_nsp->mnt_ns); | ||
68 | goto out_ns; | 70 | goto out_ns; |
71 | } | ||
69 | 72 | ||
70 | new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns); | 73 | new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns); |
71 | if (IS_ERR(new_nsp->uts_ns)) | 74 | if (IS_ERR(new_nsp->uts_ns)) { |
75 | err = PTR_ERR(new_nsp->uts_ns); | ||
72 | goto out_uts; | 76 | goto out_uts; |
77 | } | ||
73 | 78 | ||
74 | new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns); | 79 | new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns); |
75 | if (IS_ERR(new_nsp->ipc_ns)) | 80 | if (IS_ERR(new_nsp->ipc_ns)) { |
81 | err = PTR_ERR(new_nsp->ipc_ns); | ||
76 | goto out_ipc; | 82 | goto out_ipc; |
83 | } | ||
77 | 84 | ||
78 | new_nsp->pid_ns = copy_pid_ns(flags, tsk->nsproxy->pid_ns); | 85 | new_nsp->pid_ns = copy_pid_ns(flags, tsk->nsproxy->pid_ns); |
79 | if (IS_ERR(new_nsp->pid_ns)) | 86 | if (IS_ERR(new_nsp->pid_ns)) { |
87 | err = PTR_ERR(new_nsp->pid_ns); | ||
80 | goto out_pid; | 88 | goto out_pid; |
89 | } | ||
81 | 90 | ||
82 | new_nsp->user_ns = copy_user_ns(flags, tsk->nsproxy->user_ns); | 91 | new_nsp->user_ns = copy_user_ns(flags, tsk->nsproxy->user_ns); |
83 | if (IS_ERR(new_nsp->user_ns)) | 92 | if (IS_ERR(new_nsp->user_ns)) { |
93 | err = PTR_ERR(new_nsp->user_ns); | ||
84 | goto out_user; | 94 | goto out_user; |
95 | } | ||
85 | 96 | ||
86 | return new_nsp; | 97 | return new_nsp; |
87 | 98 | ||
@@ -99,7 +110,7 @@ out_uts: | |||
99 | put_mnt_ns(new_nsp->mnt_ns); | 110 | put_mnt_ns(new_nsp->mnt_ns); |
100 | out_ns: | 111 | out_ns: |
101 | kfree(new_nsp); | 112 | kfree(new_nsp); |
102 | return ERR_PTR(-ENOMEM); | 113 | return ERR_PTR(err); |
103 | } | 114 | } |
104 | 115 | ||
105 | /* | 116 | /* |