aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-06-26 03:26:04 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:26 -0400
commit2ceb8693ef63ae3d154ce1a05d275f2bb20a5e4c (patch)
tree6e61f8c5513cb905d6326417b0e95f27d3623735 /fs/exec.c
parent42c3e03ef6b298813557cdb997bd6db619cd65a2 (diff)
[PATCH] de_thread: fix lockless do_each_thread
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>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 8c5196087f31..fffea1eef8dc 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -707,7 +707,7 @@ static int de_thread(struct task_struct *tsk)
707 attach_pid(current, PIDTYPE_PID, current->pid); 707 attach_pid(current, PIDTYPE_PID, current->pid);
708 attach_pid(current, PIDTYPE_PGID, current->signal->pgrp); 708 attach_pid(current, PIDTYPE_PGID, current->signal->pgrp);
709 attach_pid(current, PIDTYPE_SID, current->signal->session); 709 attach_pid(current, PIDTYPE_SID, current->signal->session);
710 list_add_tail_rcu(&current->tasks, &init_task.tasks); 710 list_replace_rcu(&leader->tasks, &current->tasks);
711 711
712 current->group_leader = current; 712 current->group_leader = current;
713 leader->group_leader = current; 713 leader->group_leader = current;
@@ -715,7 +715,6 @@ static int de_thread(struct task_struct *tsk)
715 /* Reduce leader to a thread */ 715 /* Reduce leader to a thread */
716 detach_pid(leader, PIDTYPE_PGID); 716 detach_pid(leader, PIDTYPE_PGID);
717 detach_pid(leader, PIDTYPE_SID); 717 detach_pid(leader, PIDTYPE_SID);
718 list_del_init(&leader->tasks);
719 718
720 current->exit_signal = SIGCHLD; 719 current->exit_signal = SIGCHLD;
721 720