pty: fix O_CLOEXEC for TIOCGPTPEER
authorMatthijs van Duin <matthijsvanduin@gmail.com>
Thu, 19 Jul 2018 08:43:46 +0000 (10:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Aug 2018 11:08:55 +0000 (13:08 +0200)
commit 36ecc1481dc8d8c52d43ba18c6b642c1d2fde789 upstream.

It was being ignored because the flags were not passed to fd allocation.

Fixes: 54ebbfb16034 ("tty: add TIOCGPTPEER ioctl")
Signed-off-by: Matthijs van Duin <matthijsvanduin@gmail.com>
Acked-by: Aleksa Sarai <asarai@suse.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/pty.c

index 899e8fe5e00f512a75fe82c25b42f341eb9a338e..9e26c530d2ddb798385a2c731915e3ad336c0cd3 100644 (file)
@@ -625,7 +625,7 @@ int ptm_open_peer(struct file *master, struct tty_struct *tty, int flags)
        if (tty->driver != ptm_driver)
                return -EIO;
 
-       fd = get_unused_fd_flags(0);
+       fd = get_unused_fd_flags(flags);
        if (fd < 0) {
                retval = fd;
                goto err;