public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] namespace:unmount pid_namespace's proc_mnt when copy_net_ns failed
@ 2012-11-02  0:38 Gao feng
  2012-11-02  7:02 ` Eric W. Biederman
  0 siblings, 1 reply; 6+ messages in thread
From: Gao feng @ 2012-11-02  0:38 UTC (permalink / raw)
  To: linux-kernel, containers; +Cc: serge.hallyn, ebiederm, glommer, Gao feng

we should call pid_ns_release_proc to unmount pid_namespace's
proc_mnt when copy_net_ns failed in function create_new_namespaces.

otherwise,the proc_mnt will not be freed and because the super_block
of proc_mnt also add the reference of the pid_namespace,so this
pid_namespace will never be released too.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
 kernel/nsproxy.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index b576f7f..d536480 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -99,8 +99,11 @@ static struct nsproxy *create_new_namespaces(unsigned long flags,
 	return new_nsp;
 
 out_net:
-	if (new_nsp->pid_ns)
+	if (new_nsp->pid_ns) {
+		if (flags & CLONE_NEWPID)
+			pid_ns_release_proc(new_nsp->pid_ns);
 		put_pid_ns(new_nsp->pid_ns);
+	}
 out_pid:
 	if (new_nsp->ipc_ns)
 		put_ipc_ns(new_nsp->ipc_ns);
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-02  9:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02  0:38 [PATCH] namespace:unmount pid_namespace's proc_mnt when copy_net_ns failed Gao feng
2012-11-02  7:02 ` Eric W. Biederman
2012-11-02  7:33   ` Gao feng
2012-11-02  8:54     ` Eric W. Biederman
2012-11-02  9:02       ` Gao feng
2012-11-02  9:10         ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox