goto out_tsk;
}
- ret = -ESRCH;
-
- if (!(child->ptrace & PT_PTRACED))
- goto out_tsk;
-
- if (child->state != TASK_STOPPED) {
- if (request != PTRACE_KILL)
- goto out_tsk;
- }
-
- if (child->parent != current)
+ ret = ptrace_check_attach(child, request == PTRACE_KILL);
+ if (ret < 0)
goto out_tsk;
switch (request) {