aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2012-05-10 16:01:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-10 18:06:44 -0400
commit5e2bf0142231194d36fdc9596b36a261ed2b9fe7 (patch)
treee5b411ddefaa96b29a73706f7fe407f238632573 /kernel
parent4998a6c0edce7fae9c0a5463f6ec3fa585258ee7 (diff)
namespaces, pid_ns: fix leakage on fork() failure
Fork() failure post namespace creation for a child cloned with CLONE_NEWPID leaks pid_namespace/mnt_cache due to proc being mounted during creation, but not unmounted during cleanup. Call pid_ns_release_proc() during cleanup. Signed-off-by: Mike Galbraith <efault@gmx.de> Acked-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Louis Rilling <louis.rilling@kerlabs.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index b9372a0bff18..687a15d56243 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -47,6 +47,7 @@
47#include <linux/audit.h> 47#include <linux/audit.h>
48#include <linux/memcontrol.h> 48#include <linux/memcontrol.h>
49#include <linux/ftrace.h> 49#include <linux/ftrace.h>
50#include <linux/proc_fs.h>
50#include <linux/profile.h> 51#include <linux/profile.h>
51#include <linux/rmap.h> 52#include <linux/rmap.h>
52#include <linux/ksm.h> 53#include <linux/ksm.h>
@@ -1464,6 +1465,8 @@ bad_fork_cleanup_io:
1464 if (p->io_context) 1465 if (p->io_context)
1465 exit_io_context(p); 1466 exit_io_context(p);
1466bad_fork_cleanup_namespaces: 1467bad_fork_cleanup_namespaces:
1468 if (unlikely(clone_flags & CLONE_NEWPID))
1469 pid_ns_release_proc(p->nsproxy->pid_ns);
1467 exit_task_namespaces(p); 1470 exit_task_namespaces(p);
1468bad_fork_cleanup_mm: 1471bad_fork_cleanup_mm:
1469 if (p->mm) 1472 if (p->mm)