From: Paul Fulghum <paulkf@microgate.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] tty_set_ldisc receive_room fix
Date: Fri, 04 May 2007 14:42:02 -0500 [thread overview]
Message-ID: <1178307722.3743.8.camel@amdx2.microgate.com> (raw)
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>
--- a/drivers/char/tty_io.c 2007-04-25 22:08:32.000000000 -0500
+++ b/drivers/char/tty_io.c 2007-05-04 14:25:08.000000000 -0500
@@ -936,13 +936,6 @@ restart:
return -EINVAL;
/*
- * No more input please, we are switching. The new ldisc
- * will update this value in the ldisc open function
- */
-
- tty->receive_room = 0;
-
- /*
* Problem: What do we do if this blocks ?
*/
@@ -953,6 +946,13 @@ restart:
return 0;
}
+ /*
+ * No more input please, we are switching. The new ldisc
+ * will update this value in the ldisc open function
+ */
+
+ tty->receive_room = 0;
+
o_ldisc = tty->ldisc;
o_tty = tty->link;
next reply other threads:[~2007-05-04 19:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-04 19:42 Paul Fulghum [this message]
2007-05-05 9:18 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1178307722.3743.8.camel@amdx2.microgate.com \
--to=paulkf@microgate.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®