diff options
| -rw-r--r-- | kernel/exit.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index bbc790646502..3602f468e3a0 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -58,11 +58,11 @@ | |||
| 58 | 58 | ||
| 59 | static void exit_mm(struct task_struct * tsk); | 59 | static void exit_mm(struct task_struct * tsk); |
| 60 | 60 | ||
| 61 | static void __unhash_process(struct task_struct *p) | 61 | static void __unhash_process(struct task_struct *p, bool group_dead) |
| 62 | { | 62 | { |
| 63 | nr_threads--; | 63 | nr_threads--; |
| 64 | detach_pid(p, PIDTYPE_PID); | 64 | detach_pid(p, PIDTYPE_PID); |
| 65 | if (thread_group_leader(p)) { | 65 | if (group_dead) { |
| 66 | detach_pid(p, PIDTYPE_PGID); | 66 | detach_pid(p, PIDTYPE_PGID); |
| 67 | detach_pid(p, PIDTYPE_SID); | 67 | detach_pid(p, PIDTYPE_SID); |
| 68 | 68 | ||
| @@ -79,6 +79,7 @@ static void __unhash_process(struct task_struct *p) | |||
| 79 | static void __exit_signal(struct task_struct *tsk) | 79 | static void __exit_signal(struct task_struct *tsk) |
| 80 | { | 80 | { |
| 81 | struct signal_struct *sig = tsk->signal; | 81 | struct signal_struct *sig = tsk->signal; |
| 82 | bool group_dead = thread_group_leader(tsk); | ||
| 82 | struct sighand_struct *sighand; | 83 | struct sighand_struct *sighand; |
| 83 | struct tty_struct *uninitialized_var(tty); | 84 | struct tty_struct *uninitialized_var(tty); |
| 84 | 85 | ||
| @@ -92,7 +93,7 @@ static void __exit_signal(struct task_struct *tsk) | |||
| 92 | atomic_dec(&sig->count); | 93 | atomic_dec(&sig->count); |
| 93 | 94 | ||
| 94 | posix_cpu_timers_exit(tsk); | 95 | posix_cpu_timers_exit(tsk); |
| 95 | if (thread_group_leader(tsk)) { | 96 | if (group_dead) { |
| 96 | posix_cpu_timers_exit_group(tsk); | 97 | posix_cpu_timers_exit_group(tsk); |
| 97 | tty = sig->tty; | 98 | tty = sig->tty; |
| 98 | sig->tty = NULL; | 99 | sig->tty = NULL; |
| @@ -127,10 +128,9 @@ static void __exit_signal(struct task_struct *tsk) | |||
| 127 | sig->oublock += task_io_get_oublock(tsk); | 128 | sig->oublock += task_io_get_oublock(tsk); |
| 128 | task_io_accounting_add(&sig->ioac, &tsk->ioac); | 129 | task_io_accounting_add(&sig->ioac, &tsk->ioac); |
| 129 | sig->sum_sched_runtime += tsk->se.sum_exec_runtime; | 130 | sig->sum_sched_runtime += tsk->se.sum_exec_runtime; |
| 130 | sig = NULL; /* Marker for below. */ | ||
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | __unhash_process(tsk); | 133 | __unhash_process(tsk, group_dead); |
| 134 | 134 | ||
| 135 | /* | 135 | /* |
| 136 | * Do this under ->siglock, we can race with another thread | 136 | * Do this under ->siglock, we can race with another thread |
| @@ -142,7 +142,7 @@ static void __exit_signal(struct task_struct *tsk) | |||
| 142 | 142 | ||
| 143 | __cleanup_sighand(sighand); | 143 | __cleanup_sighand(sighand); |
| 144 | clear_tsk_thread_flag(tsk,TIF_SIGPENDING); | 144 | clear_tsk_thread_flag(tsk,TIF_SIGPENDING); |
| 145 | if (sig) { | 145 | if (group_dead) { |
| 146 | flush_sigqueue(&sig->shared_pending); | 146 | flush_sigqueue(&sig->shared_pending); |
| 147 | taskstats_tgid_free(sig); | 147 | taskstats_tgid_free(sig); |
| 148 | tty_kref_put(tty); | 148 | tty_kref_put(tty); |
