Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=680a96710041c3c25464b5e093b80ca43cb94f52 Commit: 680a96710041c3c25464b5e093b80ca43cb94f52 Parent: cdc623300841bc8f1625c320d5a6cbc52c43c60d Author: Eric W. Biederman <[EMAIL PROTECTED]> AuthorDate: Mon Feb 12 00:52:52 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Mon Feb 12 09:48:31 2007 -0800
[PATCH] tty: clarify disassociate_ctty The code to look at tty_old_pgrp and send SIGHUP and SIGCONT when it is present only executes when disassociate_ctty is called from do_exit. Make this clear by adding an explict on_exit check, and explicitly setting tty_old_pgrp to 0. In addition fix the locking by reading tty_old_pgrp under the siglock. Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]> Cc: Alan Cox <[EMAIL PROTECTED]> Cc: Oleg Nesterov <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/char/tty_io.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index b9fce77..ac937f7 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -1508,8 +1508,12 @@ void disassociate_ctty(int on_exit) /* XXX: here we race, there is nothing protecting tty */ if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY) tty_vhangup(tty); - } else { - pid_t old_pgrp = current->signal->tty_old_pgrp; + } else if (on_exit) { + pid_t old_pgrp; + spin_lock_irq(¤t->sighand->siglock); + old_pgrp = current->signal->tty_old_pgrp; + current->signal->tty_old_pgrp = 0; + spin_unlock_irq(¤t->sighand->siglock); if (old_pgrp) { kill_pg(old_pgrp, SIGHUP, on_exit); kill_pg(old_pgrp, SIGCONT, on_exit); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html