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>
This commit is contained in:
parent
5c17c861a3
commit
6d27a63caa
|
@ -269,16 +269,13 @@ static void n_tty_check_throttle(struct tty_struct *tty)
|
||||||
|
|
||||||
static void n_tty_check_unthrottle(struct tty_struct *tty)
|
static void n_tty_check_unthrottle(struct tty_struct *tty)
|
||||||
{
|
{
|
||||||
if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
|
if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
|
||||||
tty->link->ldisc->ops->write_wakeup == n_tty_write_wakeup) {
|
|
||||||
if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
|
if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
|
||||||
return;
|
return;
|
||||||
if (!tty->count)
|
if (!tty->count)
|
||||||
return;
|
return;
|
||||||
n_tty_kick_worker(tty);
|
n_tty_kick_worker(tty);
|
||||||
n_tty_write_wakeup(tty->link);
|
tty_wakeup(tty->link);
|
||||||
if (waitqueue_active(&tty->link->write_wait))
|
|
||||||
wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue