diff options
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/ptrace32.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index 9a9b04972132..7e55457a491f 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c | |||
@@ -57,30 +57,16 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
57 | (unsigned long) data); | 57 | (unsigned long) data); |
58 | #endif | 58 | #endif |
59 | lock_kernel(); | 59 | lock_kernel(); |
60 | ret = -EPERM; | ||
61 | if (request == PTRACE_TRACEME) { | 60 | if (request == PTRACE_TRACEME) { |
62 | /* are we already being traced? */ | 61 | ret = ptrace_traceme(); |
63 | if (current->ptrace & PT_PTRACED) | ||
64 | goto out; | ||
65 | if ((ret = security_ptrace(current->parent, current))) | ||
66 | goto out; | ||
67 | /* set the ptrace bit in the process flags. */ | ||
68 | current->ptrace |= PT_PTRACED; | ||
69 | ret = 0; | ||
70 | goto out; | 62 | goto out; |
71 | } | 63 | } |
72 | ret = -ESRCH; | ||
73 | read_lock(&tasklist_lock); | ||
74 | child = find_task_by_pid(pid); | ||
75 | if (child) | ||
76 | get_task_struct(child); | ||
77 | read_unlock(&tasklist_lock); | ||
78 | if (!child) | ||
79 | goto out; | ||
80 | 64 | ||
81 | ret = -EPERM; | 65 | child = ptrace_get_task_struct(pid); |
82 | if (pid == 1) /* you may not mess with init */ | 66 | if (IS_ERR(child)) { |
83 | goto out_tsk; | 67 | ret = PTR_ERR(child); |
68 | goto out; | ||
69 | } | ||
84 | 70 | ||
85 | if (request == PTRACE_ATTACH) { | 71 | if (request == PTRACE_ATTACH) { |
86 | ret = ptrace_attach(child); | 72 | ret = ptrace_attach(child); |