aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-11 01:40:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-27 02:17:54 -0500
commit6d27a63caad3f13e96cf065d2d96828c2006be6b (patch)
tree9ac73a342940bb6c283e37f23e8384155c59dfb1
parent5c17c861a357e9458001f021a7afa7aab9937439 (diff)
n_tty: Fix unsafe reference to "other" ldisc
Although n_tty_check_unthrottle() has a valid ldisc reference (since the tty core gets the ldisc ref in tty_read() before calling the line discipline read() method), it does not have a valid ldisc reference to the "other" pty of a pty pair. Since getting an ldisc reference for tty->link essentially open-codes tty_wakeup(), just replace with the equivalent tty_wakeup(). Cc: <stable@vger.kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/n_tty.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index d9a5fc28fef4..b280abaad91b 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -269,16 +269,13 @@ static void n_tty_check_throttle(struct tty_struct *tty)
269 269
270static void n_tty_check_unthrottle(struct tty_struct *tty) 270static void n_tty_check_unthrottle(struct tty_struct *tty)
271{ 271{
272 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 272 if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
273 tty->link->ldisc->ops->write_wakeup == n_tty_write_wakeup) {
274 if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE) 273 if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
275 return; 274 return;
276 if (!tty->count) 275 if (!tty->count)
277 return; 276 return;
278 n_tty_kick_worker(tty); 277 n_tty_kick_worker(tty);
279 n_tty_write_wakeup(tty->link); 278 tty_wakeup(tty->link);
280 if (waitqueue_active(&tty->link->write_wait))
281 wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
282 return; 279 return;
283 } 280 }
284 281