tty: the vhangup syscall is racy

We now have the infrastructure to sort this out but rather than teaching
the syscall tty lock rules we move the hard work into a tty helper

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alan Cox
2008-10-13 10:40:30 +01:00
committed by Linus Torvalds
父節點 216ba023a9
當前提交 2cb5998b5f
共有 3 個文件被更改,包括 21 次插入2 次删除

查看文件

@@ -729,6 +729,25 @@ void tty_vhangup(struct tty_struct *tty)
EXPORT_SYMBOL(tty_vhangup);
/**
* tty_vhangup_self - process vhangup for own ctty
*
* Perform a vhangup on the current controlling tty
*/
void tty_vhangup_self(void)
{
struct tty_struct *tty;
mutex_lock(&tty_mutex);
tty = get_current_tty();
if (tty) {
tty_vhangup(tty);
tty_kref_put(tty);
}
mutex_unlock(&tty_mutex);
}
/**
* tty_hung_up_p - was tty hung up
* @filp: file pointer of tty