aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-03-28 16:11:02 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 18:36:40 -0800
commit652486fb84a07ed750f1c11639518f55808bf555 (patch)
tree5fb6963a68dd63591f247d9bfc9f9e2d10468fb9 /drivers/char/tty_io.c
parent[PATCH] do_tty_hangup: use group_send_sig_info not send_group_sig_info (diff)
downloadlinux-dev-652486fb84a07ed750f1c11639518f55808bf555.tar.xz
linux-dev-652486fb84a07ed750f1c11639518f55808bf555.zip
[PATCH] do_SAK: don't depend on session ID 0
I'm not really certain what the thinking was but the code obviously wanted to walk processes other than just those in it's session, for purposes of do_SAK. Just walking those tasks that don't have a session assigned sounds at the very least incomplete. So modify the code to kill everything in the session and anything else that might have the tty open. Hopefully this helps if the do_SAK functionality is ever finished. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to '')
-rw-r--r--drivers/char/tty_io.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bd73242fe159..0bfd1b63662e 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2672,7 +2672,7 @@ static void __do_SAK(void *arg)
tty_hangup(tty);
#else
struct tty_struct *tty = arg;
- struct task_struct *p;
+ struct task_struct *g, *p;
int session;
int i;
struct file *filp;
@@ -2693,8 +2693,18 @@ static void __do_SAK(void *arg)
tty->driver->flush_buffer(tty);
read_lock(&tasklist_lock);
+ /* Kill the entire session */
do_each_task_pid(session, PIDTYPE_SID, p) {
- if (p->signal->tty == tty || session > 0) {
+ printk(KERN_NOTICE "SAK: killed process %d"
+ " (%s): p->signal->session==tty->session\n",
+ p->pid, p->comm);
+ send_sig(SIGKILL, p, 1);
+ } while_each_task_pid(session, PIDTYPE_SID, p);
+ /* Now kill any processes that happen to have the
+ * tty open.
+ */
+ do_each_thread(g, p) {
+ if (p->signal->tty == tty) {
printk(KERN_NOTICE "SAK: killed process %d"
" (%s): p->signal->session==tty->session\n",
p->pid, p->comm);
@@ -2721,7 +2731,7 @@ static void __do_SAK(void *arg)
rcu_read_unlock();
}
task_unlock(p);
- } while_each_task_pid(session, PIDTYPE_SID, p);
+ } while_each_thread(g, p);
read_unlock(&tasklist_lock);
#endif
}