summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 92af5cde9bb..356d91fa095 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -80,6 +80,7 @@ static void __exit_signal(struct task_struct *tsk)
{
struct signal_struct *sig = tsk->signal;
struct sighand_struct *sighand;
+ struct tty_struct *uninitialized_var(tty);
BUG_ON(!sig);
BUG_ON(!atomic_read(&sig->count));
@@ -93,6 +94,8 @@ static void __exit_signal(struct task_struct *tsk)
posix_cpu_timers_exit(tsk);
if (thread_group_leader(tsk)) {
posix_cpu_timers_exit_group(tsk);
+ tty = sig->tty;
+ sig->tty = NULL;
} else {
/*
* If there is any task waiting for the group exit
@@ -147,7 +150,7 @@ static void __exit_signal(struct task_struct *tsk)
* see account_group_exec_runtime().
*/
task_rq_unlock_wait(tsk);
- tty_kref_put(sig->tty);
+ tty_kref_put(tty);
}
}