diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-01-10 22:40:56 -0800 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2016-02-17 10:22:43 +0000 |
commit | 95ff4bf5f7517ec99a7b8e8a94e4a7e3a0703682 (patch) | |
tree | bfbaf762fa058e1f134f42a100f8338bf192b70f | |
parent | 446c7d0ac2244591db162c9c0e1890599cf072df (diff) | |
download | linux-stable-95ff4bf5f7517ec99a7b8e8a94e4a7e3a0703682.tar.gz linux-stable-95ff4bf5f7517ec99a7b8e8a94e4a7e3a0703682.tar.bz2 linux-stable-95ff4bf5f7517ec99a7b8e8a94e4a7e3a0703682.zip |
n_tty: Fix unsafe reference to "other" ldisc
commit 6d27a63caad3f13e96cf065d2d96828c2006be6b upstream.
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().
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
-rw-r--r-- | drivers/tty/n_tty.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index d239fdba29d6..cdf72bcb3d78 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -277,16 +277,13 @@ static void n_tty_check_throttle(struct tty_struct *tty) static void n_tty_check_unthrottle(struct tty_struct *tty) { - if (tty->driver->type == TTY_DRIVER_TYPE_PTY && - tty->link->ldisc->ops->write_wakeup == n_tty_write_wakeup) { + if (tty->driver->type == TTY_DRIVER_TYPE_PTY) { if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE) return; if (!tty->count) return; n_tty_set_room(tty); - n_tty_write_wakeup(tty->link); - if (waitqueue_active(&tty->link->write_wait)) - wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT); + tty_wakeup(tty->link); return; } |