diff options
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r-- | kernel/ptrace.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 64191fa09b7e..dfcd83ceee3b 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -604,10 +604,11 @@ repeat: | |||
604 | ret = security_ptrace_traceme(current->parent); | 604 | ret = security_ptrace_traceme(current->parent); |
605 | 605 | ||
606 | /* | 606 | /* |
607 | * Set the ptrace bit in the process ptrace flags. | 607 | * Check PF_EXITING to ensure ->real_parent has not passed |
608 | * Then link us on our parent's ptraced list. | 608 | * exit_ptrace(). Otherwise we don't report the error but |
609 | * pretend ->real_parent untraces us right after return. | ||
609 | */ | 610 | */ |
610 | if (!ret) { | 611 | if (!ret && !(current->real_parent->flags & PF_EXITING)) { |
611 | current->ptrace |= PT_PTRACED; | 612 | current->ptrace |= PT_PTRACED; |
612 | __ptrace_link(current, current->real_parent); | 613 | __ptrace_link(current, current->real_parent); |
613 | } | 614 | } |