Commit 85dfd81d authored by Linus Torvalds's avatar Linus Torvalds

pty: fix data loss when stopped (^S/^Q)

Commit d945cb9c ("pty: Rework the pty layer to use the normal buffering
logic") dropped the test for 'tty->stopped' in pty_write_room(), which
then causes the n_tty line discipline thing to not throttle the data
properly when the tty is stopped.

So instead of pausing the write due to the tty being stopped, the ldisc
layer would go ahead and push it down to the pty.  The pty write()
routine would then refuse to take the data (because it _did_ check
'stopped'), and the data wouldn't actually be written.

This whole stopped test should eventually be moved into the tty ldisc
layer rather than have low-level tty drivers care about these things,
but right now the fix is to just re-instate the missing pty 'stopped'
handling.
Reported-and-tested-by: default avatarArtur Skawina <art.08.09@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d00aa669
...@@ -144,6 +144,8 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, ...@@ -144,6 +144,8 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf,
static int pty_write_room(struct tty_struct *tty) static int pty_write_room(struct tty_struct *tty)
{ {
if (tty->stopped)
return 0;
return pty_space(tty->link); return pty_space(tty->link);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment