public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ryan Arnold <rsa@us.ibm.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: ldisc writes during tty release_dev() causing problems.
Date: Fri, 24 Sep 2004 11:18:54 -0500	[thread overview]
Message-ID: <1096042734.3355.51.camel@localhost.localdomain> (raw)
In-Reply-To: <1096029621.9790.8.camel@localhost.localdomain>

On Fri, 2004-09-24 at 07:40, Alan Cox wrote:

> > If tty release_dev() is called when write_chan() is blocked awaiting I/O
> > with the driver and tty->count == 1 the final call to driver->close()
> > will clean up the driver without the ldisc knowing that the driver has
> > closed the device.
> 
> That should not be possible. The terminal cannot be both blocking in
> write_chan and executing a close path for the final opener.

Thanks for the reply Alan,

I think I see what you mean.  The ldisc write_chan code is actually
invoked from the terminal process and if this is I/O blocked then the
terminal process cannot invoke release_dev().  So why did I experience
calls to hvc_write() after the final open instance was closed with
release_dev()?

> > Additionally, there doesn't seem to be anything to prevent hangup being
> > called on a tty during the final close operation (this actually happened
> > in hvc_console).
> 
> I had assumed would have to come from the serial side because if the
> last owner is executing close() they can't be executing vhangup on the
> same but given a rapid close/re-open/vhangup on a new fd it might be
> a dangerous assumption. Added to the TODO pile

In hvc_console we don't have a serial side, but I do have the device
side which will invoke a tty_hangup() if an hvc adapter was hotplug
removed.  This doesn't happen for the actual console adapter (hvc0)
because it isn't allowed in firmware.

So my strategy for now is going to be to get rid of the tty->driver_data
= NULL in hvc_close() and simply check the open count in hvc_hangup()
and hvc_write() to verify that these operations are actually relevant.

thanks again Alan,

Ryan S. Arnold
IBM Linux Technology Center


  reply	other threads:[~2004-09-24 16:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15 18:43 [PATCH] hvc_console fix to protect hvc_write against ldisc write after hvc_close Ryan Arnold
2004-09-15 19:20 ` Alan Cox
2004-09-15 21:23   ` Ryan Arnold
2004-09-15 20:41 ` Theodore Ts'o
2004-09-15 21:36   ` Alan Cox
2004-09-15 22:35   ` Ryan Arnold
2004-09-24  1:15   ` ldisc writes during tty release_dev() causing problems Ryan Arnold
2004-09-24 12:40     ` Alan Cox
2004-09-24 16:18       ` Ryan Arnold [this message]
2004-09-24 15:30         ` 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=1096042734.3355.51.camel@localhost.localdomain \
    --to=rsa@us.ibm.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