diff options
Diffstat (limited to 'kernel/nsproxy.c')
-rw-r--r-- | kernel/nsproxy.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index f223c15c18e9..e2ce748e96af 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/init_task.h> | 19 | #include <linux/init_task.h> |
20 | #include <linux/mnt_namespace.h> | 20 | #include <linux/mnt_namespace.h> |
21 | #include <linux/utsname.h> | 21 | #include <linux/utsname.h> |
22 | #include <linux/pid_namespace.h> | ||
22 | 23 | ||
23 | struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy); | 24 | struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy); |
24 | 25 | ||
@@ -68,6 +69,8 @@ struct nsproxy *dup_namespaces(struct nsproxy *orig) | |||
68 | get_uts_ns(ns->uts_ns); | 69 | get_uts_ns(ns->uts_ns); |
69 | if (ns->ipc_ns) | 70 | if (ns->ipc_ns) |
70 | get_ipc_ns(ns->ipc_ns); | 71 | get_ipc_ns(ns->ipc_ns); |
72 | if (ns->pid_ns) | ||
73 | get_pid_ns(ns->pid_ns); | ||
71 | } | 74 | } |
72 | 75 | ||
73 | return ns; | 76 | return ns; |
@@ -111,10 +114,17 @@ int copy_namespaces(int flags, struct task_struct *tsk) | |||
111 | if (err) | 114 | if (err) |
112 | goto out_ipc; | 115 | goto out_ipc; |
113 | 116 | ||
117 | err = copy_pid_ns(flags, tsk); | ||
118 | if (err) | ||
119 | goto out_pid; | ||
120 | |||
114 | out: | 121 | out: |
115 | put_nsproxy(old_ns); | 122 | put_nsproxy(old_ns); |
116 | return err; | 123 | return err; |
117 | 124 | ||
125 | out_pid: | ||
126 | if (new_ns->ipc_ns) | ||
127 | put_ipc_ns(new_ns->ipc_ns); | ||
118 | out_ipc: | 128 | out_ipc: |
119 | if (new_ns->uts_ns) | 129 | if (new_ns->uts_ns) |
120 | put_uts_ns(new_ns->uts_ns); | 130 | put_uts_ns(new_ns->uts_ns); |
@@ -129,11 +139,13 @@ out_ns: | |||
129 | 139 | ||
130 | void free_nsproxy(struct nsproxy *ns) | 140 | void free_nsproxy(struct nsproxy *ns) |
131 | { | 141 | { |
132 | if (ns->mnt_ns) | 142 | if (ns->mnt_ns) |
133 | put_mnt_ns(ns->mnt_ns); | 143 | put_mnt_ns(ns->mnt_ns); |
134 | if (ns->uts_ns) | 144 | if (ns->uts_ns) |
135 | put_uts_ns(ns->uts_ns); | 145 | put_uts_ns(ns->uts_ns); |
136 | if (ns->ipc_ns) | 146 | if (ns->ipc_ns) |
137 | put_ipc_ns(ns->ipc_ns); | 147 | put_ipc_ns(ns->ipc_ns); |
138 | kfree(ns); | 148 | if (ns->pid_ns) |
149 | put_pid_ns(ns->pid_ns); | ||
150 | kfree(ns); | ||
139 | } | 151 | } |