Re: [PATCH 1/1] tty: Fix pty master poll() after slave closes

From: Francesco Ruggeri
Date: Thu Oct 09 2014 - 13:39:52 EST


Hi Peter,
thanks for your reply.

>> poll_wait(file, &tty->read_wait, wait);
>> poll_wait(file, &tty->write_wait, wait);
>> - if (input_available_p(tty, 1))
>> - mask |= POLLIN | POLLRDNORM;
>> if (tty->packet && tty->link->ctrl_status)
>> mask |= POLLPRI | POLLIN | POLLRDNORM;
>> if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
>> mask |= POLLHUP;
>> if (tty_hung_up_p(file))
>> mask |= POLLHUP;
>> + if (mask & POLLHUP)
>> + tty_flush_to_ldisc(tty);
>
> This isn't necessary for the tty_hung_up_p() case because, when the
> poll() is woken from hangup, the read buffer has already been flushed (ie.,
> cleared).
>
> Plus, this waits even if input_available_p() would already return true.
>

Let me work on a patch for stable along the lines you suggest.

Francesco
--
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/