diff options
Diffstat (limited to 'arch/s390/kernel/ptrace.c')
-rw-r--r-- | arch/s390/kernel/ptrace.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 8ecda6d66de4..cc02232aa96e 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -712,35 +712,18 @@ sys_ptrace(long request, long pid, long addr, long data) | |||
712 | int ret; | 712 | int ret; |
713 | 713 | ||
714 | lock_kernel(); | 714 | lock_kernel(); |
715 | |||
716 | if (request == PTRACE_TRACEME) { | 715 | if (request == PTRACE_TRACEME) { |
717 | /* are we already being traced? */ | 716 | ret = ptrace_traceme(); |
718 | ret = -EPERM; | 717 | goto out; |
719 | if (current->ptrace & PT_PTRACED) | ||
720 | goto out; | ||
721 | ret = security_ptrace(current->parent, current); | ||
722 | if (ret) | ||
723 | goto out; | ||
724 | /* set the ptrace bit in the process flags. */ | ||
725 | current->ptrace |= PT_PTRACED; | ||
726 | goto out; | ||
727 | } | 718 | } |
728 | 719 | ||
729 | ret = -EPERM; | 720 | child = ptrace_get_task_struct(pid); |
730 | if (pid == 1) /* you may not mess with init */ | 721 | if (IS_ERR(child)) { |
731 | goto out; | 722 | ret = PTR_ERR(child); |
732 | |||
733 | ret = -ESRCH; | ||
734 | read_lock(&tasklist_lock); | ||
735 | child = find_task_by_pid(pid); | ||
736 | if (child) | ||
737 | get_task_struct(child); | ||
738 | read_unlock(&tasklist_lock); | ||
739 | if (!child) | ||
740 | goto out; | 723 | goto out; |
724 | } | ||
741 | 725 | ||
742 | ret = do_ptrace(child, request, addr, data); | 726 | ret = do_ptrace(child, request, addr, data); |
743 | |||
744 | put_task_struct(child); | 727 | put_task_struct(child); |
745 | out: | 728 | out: |
746 | unlock_kernel(); | 729 | unlock_kernel(); |