public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] pidns: fix free_pid() to handle the first fork failure
@ 2013-09-15 17:26 Oleg Nesterov
  2013-09-16 11:35 ` Eric W. Biederman
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2013-09-15 17:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Eric W. Biederman, Serge E. Hallyn, linux-kernel

"case 0" in free_pid() assumes that disable_pid_allocation() should
clear PIDNS_HASH_ADDING before the last pid goes away. However this
doesn't happen if the 1st fork() fails to create the child reaper
which should call disable_pid_allocation().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/pid.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/pid.c b/kernel/pid.c
index 66505c1..606a212 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -272,6 +272,11 @@ void free_pid(struct pid *pid)
 			 */
 			wake_up_process(ns->child_reaper);
 			break;
+		case PIDNS_HASH_ADDING:
+			/* Handle a fork failure of the first process */
+			WARN_ON(ns->child_reaper);
+			ns->nr_hashed = 0;
+			/* fall through */
 		case 0:
 			schedule_work(&ns->proc_work);
 			break;
-- 
1.5.5.1



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

end of thread, other threads:[~2013-09-16 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-15 17:26 [PATCH RESEND] pidns: fix free_pid() to handle the first fork failure Oleg Nesterov
2013-09-16 11:35 ` 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