Skip to content

Commit

Permalink
n_tty: Fix throttle for canon lines > 3967 chars
Browse files Browse the repository at this point in the history
The tty driver will be mistakenly throttled if a line termination
has not been received, and the line exceeds 3967 chars. Thus, it is
possible for the driver to stop sending when it has not yet sent
the newline. This does not apply to the pty driver.

Don't throttle until at least one line termination has been
received.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Feb 2, 2015
1 parent 2c5dc46 commit a342846
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,18 @@ static void n_tty_write_wakeup(struct tty_struct *tty)

static void n_tty_check_throttle(struct tty_struct *tty)
{
struct n_tty_data *ldata = tty->disc_data;

if (tty->driver->type == TTY_DRIVER_TYPE_PTY)
return;
/*
* Check the remaining room for the input canonicalization
* mode. We don't want to throttle the driver if we're in
* canonical mode and don't have a newline yet!
*/
if (ldata->icanon && ldata->canon_head == ldata->read_tail)
return;

while (1) {
int throttled;
tty_set_flow_change(tty, TTY_THROTTLE_SAFE);
Expand Down

0 comments on commit a342846

Please sign in to comment.