public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	roland@redhat.com, linux-kernel@vger.kernel.org,
	Pavel Emelyanov <xemul@openvz.org>,
	Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Valdis.Kletnieks@vt.edu
Subject: [PATCH] (for -mm only) put_pid: make sure we don't free the live pid
Date: Wed, 20 Feb 2008 19:14:39 +0300	[thread overview]
Message-ID: <20080220161439.GA146@tv-sign.ru> (raw)
In-Reply-To: <23492.1203464394@turing-police.cc.vt.edu>

[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);
 	}


  reply	other threads:[~2008-02-20 16:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 18:02 [PATCH] do_signal_stop: use signal_group_exit() Oleg Nesterov
2008-02-16  3:37 ` Andrew Morton
2008-02-16 14:02   ` Oleg Nesterov
2008-02-17 23:10     ` Oleg Nesterov
2008-02-18  4:11       ` Eric W. Biederman
2008-02-19 23:39         ` Valdis.Kletnieks
2008-02-20 16:14           ` Oleg Nesterov [this message]
2008-02-20 16:18           ` tty && pid problems Oleg Nesterov
2008-02-20 16:19             ` Alan Cox
2008-02-22  1:39               ` Eric W. Biederman
2008-02-22  9:37                 ` Alan Cox
2008-02-20 16:28             ` Oleg Nesterov
2008-02-20 19:00               ` Jiri Slaby
2008-02-20  2:32       ` [PATCH] do_signal_stop: use signal_group_exit() Eric W. Biederman
2008-02-16 15:09   ` [PATCH] free_pidmap: turn it into free_pidmap(struct upid *) Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080220161439.GA146@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ebiederm@xmission.com \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=xemul@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox