Skip to content

Commit

Permalink
[PATCH] de_thread: fix lockless do_each_thread
Browse files Browse the repository at this point in the history
We should keep the value of old_leader->tasks.next in de_thread, otherwise
we can't do for_each_process/do_each_thread without tasklist_lock held.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jun 26, 2006
1 parent 42c3e03 commit 2ceb869
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,15 +707,14 @@ static int de_thread(struct task_struct *tsk)
attach_pid(current, PIDTYPE_PID, current->pid);
attach_pid(current, PIDTYPE_PGID, current->signal->pgrp);
attach_pid(current, PIDTYPE_SID, current->signal->session);
list_add_tail_rcu(&current->tasks, &init_task.tasks);
list_replace_rcu(&leader->tasks, &current->tasks);

current->group_leader = current;
leader->group_leader = current;

/* Reduce leader to a thread */
detach_pid(leader, PIDTYPE_PGID);
detach_pid(leader, PIDTYPE_SID);
list_del_init(&leader->tasks);

current->exit_signal = SIGCHLD;

Expand Down

0 comments on commit 2ceb869

Please sign in to comment.