[PATCH] (for -mm only) put_pid: make sure we don't free the live pid

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Oleg Nesterov
Date: Wednesday, February 20, 2008 - 9:14 am

[PATCH] (for -mm only) put_pid: make sure we don't free the live pid

Add the temporary (for -mm only) debugging code to catch the unbalanced
put_pid()'s. At least those which can free the "live" pid.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- MM/kernel/pid.c~	2008-02-20 18:29:40.000000000 +0300
+++ MM/kernel/pid.c	2008-02-20 18:35:15.000000000 +0300
@@ -208,6 +208,10 @@ void put_pid(struct pid *pid)
 	ns = pid->numbers[pid->level].ns;
 	if ((atomic_read(&pid->count) == 1) ||
 	     atomic_dec_and_test(&pid->count)) {
+		int type = PIDTYPE_MAX;
+		while (--type >= 0)
+			if (WARN_ON(!hlist_empty(&pid->tasks[type])))
+				return;
 		kmem_cache_free(ns->pid_cachep, pid);
 		put_pid_ns(ns);
 	}

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] do_signal_stop: use signal_group_exit(), Oleg Nesterov, (Fri Feb 15, 11:02 am)
Re: [PATCH] do_signal_stop: use signal_group_exit(), Andrew Morton, (Fri Feb 15, 8:37 pm)
Re: [PATCH] do_signal_stop: use signal_group_exit(), Oleg Nesterov, (Sat Feb 16, 7:02 am)
Re: [PATCH] do_signal_stop: use signal_group_exit(), Oleg Nesterov, (Sun Feb 17, 4:10 pm)
Re: [PATCH] do_signal_stop: use signal_group_exit(), Eric W. Biederman, (Sun Feb 17, 9:11 pm)
Re: [PATCH] do_signal_stop: use signal_group_exit(), Valdis.Kletnieks, (Tue Feb 19, 4:39 pm)
Re: [PATCH] do_signal_stop: use signal_group_exit(), Eric W. Biederman, (Tue Feb 19, 7:32 pm)
[PATCH] (for -mm only) put_pid: make sure we don't free th ..., Oleg Nesterov, (Wed Feb 20, 9:14 am)
tty &amp;&amp; pid problems, Oleg Nesterov, (Wed Feb 20, 9:18 am)
Re: tty &amp;&amp; pid problems, Alan Cox, (Wed Feb 20, 9:19 am)
Re: tty &amp;&amp; pid problems, Oleg Nesterov, (Wed Feb 20, 9:28 am)
Re: tty &amp;&amp; pid problems, Jiri Slaby, (Wed Feb 20, 12:00 pm)
Re: tty &amp;&amp; pid problems, Eric W. Biederman, (Thu Feb 21, 6:39 pm)
Re: tty &amp;&amp; pid problems, Alan Cox, (Fri Feb 22, 2:37 am)