]> git.baikalelectronics.ru Git - kernel.git/commit
tty: Fix spurious poll() wakeups
authorPeter Hurley <peter@hurleysoftware.com>
Thu, 7 Aug 2014 11:14:10 +0000 (07:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 22:55:25 +0000 (15:55 -0700)
commit26a977f4bc2ad7f0515118a0e855ef370706e650
tree79c4c9c407bb737a19fdbdcd1e76bb9da737ffab
parentb7e4449756501d4930d244a243282358bfb86f8f
tty: Fix spurious poll() wakeups

When the N_TTY line discipline receives data and wakes readers to
process the input, polling writers are also mistakenly woken. This
is because, although readers and writers are differentiated by
different wait queues (tty->read_wait & tty->write_wait), both
wait queues are polled together. Thus, reader wakeups without poll
flags still cause poll(POLLOUT) to wakeup.

For received data, wakeup readers with POLLIN. Preserve the
unspecific wakeup in n_tty_packet_mode_flush(), as this action
should flag both POLLIN and POLLOUT.

Fixes epoll_wait() for edge-triggered EPOLLOUT.

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