aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-08-07 07:14:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-08 18:55:25 -0400
commit57087d515441cab49ff02480aa40a09abfe02c78 (patch)
tree79c4c9c407bb737a19fdbdcd1e76bb9da737ffab /drivers/tty/n_tty.c
parentb216df53848129c969a465bb9237fbc9b8fafaad (diff)
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>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index f44f1ba762c3..89c4cee253e3 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1166,7 +1166,7 @@ static void n_tty_receive_break(struct tty_struct *tty)
1166 } 1166 }
1167 put_tty_queue('\0', ldata); 1167 put_tty_queue('\0', ldata);
1168 if (waitqueue_active(&tty->read_wait)) 1168 if (waitqueue_active(&tty->read_wait))
1169 wake_up_interruptible(&tty->read_wait); 1169 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1170} 1170}
1171 1171
1172/** 1172/**
@@ -1226,7 +1226,7 @@ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c)
1226 } else 1226 } else
1227 put_tty_queue(c, ldata); 1227 put_tty_queue(c, ldata);
1228 if (waitqueue_active(&tty->read_wait)) 1228 if (waitqueue_active(&tty->read_wait))
1229 wake_up_interruptible(&tty->read_wait); 1229 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1230} 1230}
1231 1231
1232static void 1232static void
@@ -1378,7 +1378,7 @@ handle_newline:
1378 ldata->canon_head = ldata->read_head; 1378 ldata->canon_head = ldata->read_head;
1379 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1379 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1380 if (waitqueue_active(&tty->read_wait)) 1380 if (waitqueue_active(&tty->read_wait))
1381 wake_up_interruptible(&tty->read_wait); 1381 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1382 return 0; 1382 return 0;
1383 } 1383 }
1384 } 1384 }
@@ -1679,7 +1679,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
1679 L_EXTPROC(tty)) { 1679 L_EXTPROC(tty)) {
1680 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1680 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1681 if (waitqueue_active(&tty->read_wait)) 1681 if (waitqueue_active(&tty->read_wait))
1682 wake_up_interruptible(&tty->read_wait); 1682 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1683 } 1683 }
1684} 1684}
1685 1685