summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2003-08-05 10:52:34 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-08-05 10:52:34 -0700
commit4bce33009891a04bcc0bbe736ba2d0daf8536bf5 (patch)
treeaec98c04bd9a38e32bace2d26fd9fa24cc974602 /kernel
parent1c2a284f636b1af15d5dadb905aae8796bfa5b42 (diff)
[PATCH] fix spinlock deadlock in ptrace-reaping of detached thread
When a dead detached thread has been temporarily zombified because it's ptraced and its tracer tries to reap it, it deadlocks on SMP. Here's the fix.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index d5f45b814d1f..a7328cc9992b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -898,13 +898,19 @@ static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *r
__ptrace_unlink(p);
p->state = TASK_ZOMBIE;
/* If this is a detached thread, this is where it goes away. */
- if (p->exit_signal == -1)
+ if (p->exit_signal == -1) {
+ /* release_task takes the lock itself. */
+ write_unlock_irq(&tasklist_lock);
release_task (p);
- else
+ }
+ else {
do_notify_parent(p, p->exit_signal);
+ write_unlock_irq(&tasklist_lock);
+ }
p = NULL;
}
- write_unlock_irq(&tasklist_lock);
+ else
+ write_unlock_irq(&tasklist_lock);
}
if (p != NULL)
release_task(p);