From: Oleg Nesterov Date: Fri, 8 Feb 2008 12:19:00 +0000 (-0800) Subject: ptrace_check_attach: remove unneeded ->signal != NULL check X-Git-Tag: v2.6.25-rc1~231 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=c0c0b649d67aa775aa9851de61aade17504be70c;p=linux-2.6-omap-h63xx.git ptrace_check_attach: remove unneeded ->signal != NULL check It is not possible to see the PT_PTRACED task without ->signal/sighand under tasklist_lock, release_task() does ptrace_unlink() first. If the task was already released before, ptrace_attach() can't succeed and set PT_PTRACED. Remove this check. Signed-off-by: Oleg Nesterov Acked-by: Roland McGrath Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 2dc00298e67..fdb34e86f92 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -99,9 +99,12 @@ int ptrace_check_attach(struct task_struct *child, int kill) * be changed by us so it's not changing right after this. */ read_lock(&tasklist_lock); - if ((child->ptrace & PT_PTRACED) && child->parent == current && - child->signal != NULL) { + if ((child->ptrace & PT_PTRACED) && child->parent == current) { ret = 0; + /* + * child->sighand can't be NULL, release_task() + * does ptrace_unlink() before __exit_signal(). + */ spin_lock_irq(&child->sighand->siglock); if (task_is_stopped(child)) child->state = TASK_TRACED;