2018-07-19 08:44:52

by Matthijs van Duin

[permalink] [raw]
Subject: [PATCH] pty: fix O_CLOEXEC for TIOCGPTPEER

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 <[email protected]>
---
drivers/tty/pty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index b0e2c4847a5d..678406e0948b 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -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;
--
2.18.0



2018-07-19 17:19:02

by Aleksa Sarai

[permalink] [raw]
Subject: Re: [PATCH] pty: fix O_CLOEXEC for TIOCGPTPEER

On 2018-07-19, Matthijs van Duin <[email protected]> wrote:
> It was being ignored because the flags were not passed to fd allocation.
>
> Fixes: 54ebbfb16034 ("tty: add TIOCGPTPEER ioctl")

Acked-by: Aleksa Sarai <[email protected]>

> Signed-off-by: Matthijs van Duin <[email protected]>
> ---
> drivers/tty/pty.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
> index b0e2c4847a5d..678406e0948b 100644
> --- a/drivers/tty/pty.c
> +++ b/drivers/tty/pty.c
> @@ -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;

--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>


Attachments:
(No filename) (940.00 B)
signature.asc (849.00 B)
Download all attachments