Skip to content

Commit 6d27a63

Browse files
peterhurleygregkh
authored andcommitted
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>
1 parent 5c17c86 commit 6d27a63

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/tty/n_tty.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,13 @@ static void n_tty_check_throttle(struct tty_struct *tty)
269269

270270
static void n_tty_check_unthrottle(struct tty_struct *tty)
271271
{
272-
if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
273-
tty->link->ldisc->ops->write_wakeup == n_tty_write_wakeup) {
272+
if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
274273
if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
275274
return;
276275
if (!tty->count)
277276
return;
278277
n_tty_kick_worker(tty);
279-
n_tty_write_wakeup(tty->link);
280-
if (waitqueue_active(&tty->link->write_wait))
281-
wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
278+
tty_wakeup(tty->link);
282279
return;
283280
}
284281

0 commit comments

Comments
 (0)