diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tty_io.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 811dadb9ce3e..0bfd1b63662e 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1094,8 +1094,8 @@ static void do_tty_hangup(void *data) | |||
1094 | p->signal->tty = NULL; | 1094 | p->signal->tty = NULL; |
1095 | if (!p->signal->leader) | 1095 | if (!p->signal->leader) |
1096 | continue; | 1096 | continue; |
1097 | send_group_sig_info(SIGHUP, SEND_SIG_PRIV, p); | 1097 | group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p); |
1098 | send_group_sig_info(SIGCONT, SEND_SIG_PRIV, p); | 1098 | group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p); |
1099 | if (tty->pgrp > 0) | 1099 | if (tty->pgrp > 0) |
1100 | p->signal->tty_old_pgrp = tty->pgrp; | 1100 | p->signal->tty_old_pgrp = tty->pgrp; |
1101 | } while_each_task_pid(tty->session, PIDTYPE_SID, p); | 1101 | } while_each_task_pid(tty->session, PIDTYPE_SID, p); |
@@ -2672,7 +2672,7 @@ static void __do_SAK(void *arg) | |||
2672 | tty_hangup(tty); | 2672 | tty_hangup(tty); |
2673 | #else | 2673 | #else |
2674 | struct tty_struct *tty = arg; | 2674 | struct tty_struct *tty = arg; |
2675 | struct task_struct *p; | 2675 | struct task_struct *g, *p; |
2676 | int session; | 2676 | int session; |
2677 | int i; | 2677 | int i; |
2678 | struct file *filp; | 2678 | struct file *filp; |
@@ -2693,8 +2693,18 @@ static void __do_SAK(void *arg) | |||
2693 | tty->driver->flush_buffer(tty); | 2693 | tty->driver->flush_buffer(tty); |
2694 | 2694 | ||
2695 | read_lock(&tasklist_lock); | 2695 | read_lock(&tasklist_lock); |
2696 | /* Kill the entire session */ | ||
2696 | do_each_task_pid(session, PIDTYPE_SID, p) { | 2697 | do_each_task_pid(session, PIDTYPE_SID, p) { |
2697 | if (p->signal->tty == tty || session > 0) { | 2698 | printk(KERN_NOTICE "SAK: killed process %d" |
2699 | " (%s): p->signal->session==tty->session\n", | ||
2700 | p->pid, p->comm); | ||
2701 | send_sig(SIGKILL, p, 1); | ||
2702 | } while_each_task_pid(session, PIDTYPE_SID, p); | ||
2703 | /* Now kill any processes that happen to have the | ||
2704 | * tty open. | ||
2705 | */ | ||
2706 | do_each_thread(g, p) { | ||
2707 | if (p->signal->tty == tty) { | ||
2698 | printk(KERN_NOTICE "SAK: killed process %d" | 2708 | printk(KERN_NOTICE "SAK: killed process %d" |
2699 | " (%s): p->signal->session==tty->session\n", | 2709 | " (%s): p->signal->session==tty->session\n", |
2700 | p->pid, p->comm); | 2710 | p->pid, p->comm); |
@@ -2721,7 +2731,7 @@ static void __do_SAK(void *arg) | |||
2721 | rcu_read_unlock(); | 2731 | rcu_read_unlock(); |
2722 | } | 2732 | } |
2723 | task_unlock(p); | 2733 | task_unlock(p); |
2724 | } while_each_task_pid(session, PIDTYPE_SID, p); | 2734 | } while_each_thread(g, p); |
2725 | read_unlock(&tasklist_lock); | 2735 | read_unlock(&tasklist_lock); |
2726 | #endif | 2736 | #endif |
2727 | } | 2737 | } |