mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: akpm@osdl.org, mingo@elte.hu
Cc: linux-kernel@vger.kernel.org, dipankar@hill9.org, wli@holomorphy.com
Subject: [PATCH] tasklist-RCU fix in attach_pid()
Date: Tue, 8 Nov 2005 19:22:34 -0800	[thread overview]
Message-ID: <20051109032233.GA3060@us.ibm.com> (raw)

Hello!

Bug in attach_pid() can result in RCU readers in find_pid() getting
confused if they race with process creation.

Signed-off-by: <paulmck@us.ibm.com>

---

(applies to both 2.6.14-mm1 and -rt)

 pid.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -uprNa -X dontdiff linux-2.6.14-mm1/kernel/pid.c linux-2.6.14-mm1-fix-1/kernel/pid.c
--- linux-2.6.14-mm1/kernel/pid.c	2005-11-08 08:18:55.000000000 -0800
+++ linux-2.6.14-mm1-fix-1/kernel/pid.c	2005-11-08 19:02:35.000000000 -0800
@@ -150,6 +150,7 @@ int fastcall attach_pid(task_t *task, en
 
 	task_pid = &task->pids[type];
 	pid = find_pid(type, nr);
+	task_pid->nr = nr;
 	if (pid == NULL) {
 		INIT_LIST_HEAD(&task_pid->pid_list);
 		hlist_add_head_rcu(&task_pid->pid_chain,
@@ -158,7 +159,6 @@ int fastcall attach_pid(task_t *task, en
 		INIT_HLIST_NODE(&task_pid->pid_chain);
 		list_add_tail_rcu(&task_pid->pid_list, &pid->pid_list);
 	}
-	task_pid->nr = nr;
 
 	return 0;
 }

             reply	other threads:[~2005-11-09  3:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09  3:22 Paul E. McKenney [this message]
2005-11-09  8:14 ` William Lee Irwin III
2005-11-09 14:35 ` Ingo Molnar

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=20051109032233.GA3060@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dipankar@hill9.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=wli@holomorphy.com \
    /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

all inboxes | Powered by JetHome®