From: Oleg Nesterov <[email protected]> Subject: exit: pidns: alloc_pid() leaks pid_namespace if child_reaper is exiting
alloc_pid() does get_pid_ns() beforehand but forgets to put_pid_ns() if it fails because disable_pid_allocation() was called by the exiting child_reaper. We could simply move get_pid_ns() down to successful return, but this fix tries to be as trivial as possible. Signed-off-by: Oleg Nesterov <[email protected]> Reviewed-by: "Eric W. Biederman" <[email protected]> Cc: Aaron Tomlin <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Serge Hallyn <[email protected]> Cc: Sterling Alexander <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> --- kernel/pid.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN kernel/pid.c~exit-pidns-alloc_pid-leaks-pid_namespace-if-child_reaper-is-exiting kernel/pid.c --- a/kernel/pid.c~exit-pidns-alloc_pid-leaks-pid_namespace-if-child_reaper-is-exiting +++ a/kernel/pid.c @@ -341,6 +341,8 @@ out: out_unlock: spin_unlock_irq(&pidmap_lock); + put_pid_ns(ns); + out_free: while (++i <= ns->level) free_pidmap(pid->numbers + i); _ -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
