diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/ptrace32.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c index 61762640b877..826ee3d056de 100644 --- a/arch/powerpc/kernel/ptrace32.c +++ b/arch/powerpc/kernel/ptrace32.c | |||
@@ -45,33 +45,19 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr, | |||
45 | unsigned long data) | 45 | unsigned long data) |
46 | { | 46 | { |
47 | struct task_struct *child; | 47 | struct task_struct *child; |
48 | int ret = -EPERM; | 48 | int ret; |
49 | 49 | ||
50 | lock_kernel(); | 50 | lock_kernel(); |
51 | if (request == PTRACE_TRACEME) { | 51 | if (request == PTRACE_TRACEME) { |
52 | /* are we already being traced? */ | 52 | ret = ptrace_traceme(); |
53 | if (current->ptrace & PT_PTRACED) | ||
54 | goto out; | ||
55 | ret = security_ptrace(current->parent, current); | ||
56 | if (ret) | ||
57 | goto out; | ||
58 | /* set the ptrace bit in the process flags. */ | ||
59 | current->ptrace |= PT_PTRACED; | ||
60 | ret = 0; | ||
61 | goto out; | 53 | goto out; |
62 | } | 54 | } |
63 | ret = -ESRCH; | ||
64 | read_lock(&tasklist_lock); | ||
65 | child = find_task_by_pid(pid); | ||
66 | if (child) | ||
67 | get_task_struct(child); | ||
68 | read_unlock(&tasklist_lock); | ||
69 | if (!child) | ||
70 | goto out; | ||
71 | 55 | ||
72 | ret = -EPERM; | 56 | child = ptrace_get_task_struct(pid); |
73 | if (pid == 1) /* you may not mess with init */ | 57 | if (IS_ERR(child)) { |
74 | goto out_tsk; | 58 | ret = PTR_ERR(child); |
59 | goto out; | ||
60 | } | ||
75 | 61 | ||
76 | if (request == PTRACE_ATTACH) { | 62 | if (request == PTRACE_ATTACH) { |
77 | ret = ptrace_attach(child); | 63 | ret = ptrace_attach(child); |