diff options
author | Paul Fulghum <paulkf@microgate.com> | 2007-05-09 05:33:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:49 -0400 |
commit | ae030e435f5400cff77c52506a8d3d7278f0947c (patch) | |
tree | 73520671c56d8a54dff2a4969201251815ca93de /drivers | |
parent | 55c0d1f83e481dd6c77f52f7dcfeb043b8b740fa (diff) |
tty_set_ldisc() receive_room fix
Fix tty_set_ldisc in tty_io.c so that tty->receive_room is only cleared if
actually changing line disciplines.
Without this fix a problem occurs when requesting the line discipline to
change to the same line discipline. In this case tty->receive_room is
cleared but ldisc->open() is not called to set tty->receive_room back to a
sane value. The result is that tty->receive_room is stuck at 0 preventing
the tty flip buffer from passing receive data to the line discipline.
For example: a switch from N_TTY to N_TTY followed by a select() call for
read input results in data never being received because tty->receive_room
is stuck at zero.
A switch from N_TTY to N_TTY followed by a read() call works because the
read() call itself sets tty->receive_room correctly (but select does not).
Previously (< 2.6.18) this was not a problem because the tty flip buffer
pushed data to the line discipline without regard for tty->receive room.
Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tty_io.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 7710a6a77d97..bf5a00145c0b 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -934,13 +934,6 @@ restart: | |||
934 | return -EINVAL; | 934 | return -EINVAL; |
935 | 935 | ||
936 | /* | 936 | /* |
937 | * No more input please, we are switching. The new ldisc | ||
938 | * will update this value in the ldisc open function | ||
939 | */ | ||
940 | |||
941 | tty->receive_room = 0; | ||
942 | |||
943 | /* | ||
944 | * Problem: What do we do if this blocks ? | 937 | * Problem: What do we do if this blocks ? |
945 | */ | 938 | */ |
946 | 939 | ||
@@ -951,6 +944,13 @@ restart: | |||
951 | return 0; | 944 | return 0; |
952 | } | 945 | } |
953 | 946 | ||
947 | /* | ||
948 | * No more input please, we are switching. The new ldisc | ||
949 | * will update this value in the ldisc open function | ||
950 | */ | ||
951 | |||
952 | tty->receive_room = 0; | ||
953 | |||
954 | o_ldisc = tty->ldisc; | 954 | o_ldisc = tty->ldisc; |
955 | o_tty = tty->link; | 955 | o_tty = tty->link; |
956 | 956 | ||