From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>, "Theodore Ts'o" <tytso@mit.edu>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [RFC] potential ancient bug (since 1.99.14) at char/pty
Date: Wed, 11 Nov 2009 15:01:03 -0200 [thread overview]
Message-ID: <20091111150103.06cc3489@pedra.chehab.org> (raw)
Hi Alan/Ts'o,
There's an open bugzilla at Red Hat for the pty driver that I'm not sure
what would be the better fix. It tracks to kernel 1.99.14:
http://www.linuxhq.com/kernel/v1.99/13/drivers/char/ChangeLog
http://www.linuxhq.com/kernel/v1.99/13/drivers/char/pty.c
The code is still present upstream.
The pty changes added two lines to pty_close(): tty->packet = 0 and
tty->link->packet = 0.
The bug is at:
https://bugzilla.redhat.com/show_bug.cgi?id=504703
The result of the bug is a race condition where telnetd may not properly
recognize the logout message (as it assumes that the device is in packet mode,
where the driver already changed its state to non-packet mode).
By removing tty->link->packet = 0, it fixes the issue, with a patch like:
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -51,7 +51,6 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
tty->packet = 0;
if (!tty->link)
return;
- tty->link->packet = 0;
set_bit(TTY_OTHER_CLOSED, &tty->link->flags);
wake_up_interruptible(&tty->link->read_wait);
wake_up_interruptible(&tty->link->write_wait);
However, I'm not sure if this is the better fix, since it means that, after
closing both devices and opening again, link->packet will be 1, and this seems
wrong.
So, maybe the better way would be to add an open counter to pty and changing
link->packet to zero only if the open usage count is zero.
Another point to be considered is that a change like that on a very old code can
cause regressions on other parts.
Comments?
Cheers,
Mauro
next reply other threads:[~2009-11-11 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 17:01 Mauro Carvalho Chehab [this message]
2009-11-11 19:16 ` 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=20091111150103.06cc3489@pedra.chehab.org \
--to=mchehab@redhat.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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®