diff options
author | Mike Galbraith <efault@gmx.de> | 2012-05-10 16:01:45 -0400 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2012-05-25 12:24:46 -0400 |
commit | ea98f373adf3d97df0f763d8c2fb0cf7d6a2e59b (patch) | |
tree | 19eaa50bc1244c521bde10f7fdc9ef2930525090 | |
parent | 057164ae71e6fe5d553fc4e3e7ee00f38e8424ca (diff) |
namespaces, pid_ns: fix leakage on fork() failure
BugLink: http://bugs.launchpad.net/bugs/1002880
commit 5e2bf0142231194d36fdc9596b36a261ed2b9fe7 upstream.
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
-rw-r--r-- | kernel/fork.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index f942a33d4c6..03fcb141044 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/audit.h> | 49 | #include <linux/audit.h> |
50 | #include <linux/memcontrol.h> | 50 | #include <linux/memcontrol.h> |
51 | #include <linux/ftrace.h> | 51 | #include <linux/ftrace.h> |
52 | #include <linux/proc_fs.h> | ||
52 | #include <linux/profile.h> | 53 | #include <linux/profile.h> |
53 | #include <linux/rmap.h> | 54 | #include <linux/rmap.h> |
54 | #include <linux/ksm.h> | 55 | #include <linux/ksm.h> |
@@ -1383,6 +1384,8 @@ bad_fork_cleanup_io: | |||
1383 | if (p->io_context) | 1384 | if (p->io_context) |
1384 | exit_io_context(p); | 1385 | exit_io_context(p); |
1385 | bad_fork_cleanup_namespaces: | 1386 | bad_fork_cleanup_namespaces: |
1387 | if (unlikely(clone_flags & CLONE_NEWPID)) | ||
1388 | pid_ns_release_proc(p->nsproxy->pid_ns); | ||
1386 | exit_task_namespaces(p); | 1389 | exit_task_namespaces(p); |
1387 | bad_fork_cleanup_mm: | 1390 | bad_fork_cleanup_mm: |
1388 | if (p->mm) { | 1391 | if (p->mm) { |