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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Alan Cox 2008-10-13 10:40:30 +01:00 • committed by Linus Torvalds
commit 2cb5998b5f
3 changed files with 21 additions and 2 deletions

View file

@ -1141,8 +1141,7 @@ EXPORT_SYMBOL(sys_close);
asmlinkage long sys_vhangup(void)
{
if (capable(CAP_SYS_TTY_CONFIG)) {
/* XXX: this needs locking */
tty_vhangup(current->signal->tty);
tty_vhangup_self();
return 0;
}
return -EPERM;