Re: [PATCH] tty: Fix unreasonable write toward closed pty.

From: Ilya Zykov
Date: Wed Dec 19 2012 - 14:38:24 EST


On 19.12.2012 23:10, Alan Cox wrote:
>> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
>> index a82b399..1ce1362 100644
>> --- a/drivers/tty/pty.c
>> +++ b/drivers/tty/pty.c
>> @@ -116,6 +116,8 @@ static int pty_space(struct tty_struct *to)
>>
>> static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
>> {
>> + if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
>> + return -EIO;
>
> The flag can change between the test and ny further code being executed ?
>
> Alan
>

Yes, if I understand you correctly, but this is no matter here,
because ldisc's layer will wait, flush this data later.
Here, only beginning stage of tty_close.
This is safe later stage from unnecessary data.

Ilya

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/