]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tty: Only allow slave pty as controlling tty
authorPeter Hurley <peter@hurleysoftware.com>
Sun, 8 Nov 2015 14:06:05 +0000 (09:06 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Dec 2015 03:59:48 +0000 (19:59 -0800)
A master pty should never be a controlling tty in Linux; if the
master pty is specified to ioctl(TIOCSCTTY), silently substitute the slave
pty as the controlling tty.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_io.c

index f38ae01c3917f7c5d8436ca342366b13b41347d7..892c923547450518cb5d7a4714f570a6803253bd 100644 (file)
@@ -2866,7 +2866,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                no_tty();
                return 0;
        case TIOCSCTTY:
-               return tiocsctty(tty, file, arg);
+               return tiocsctty(real_tty, file, arg);
        case TIOCGPGRP:
                return tiocgpgrp(tty, real_tty, p);
        case TIOCSPGRP: