Re: ldisc writes during tty release_dev() causing problems.

From: Alan Cox
Date: Fri Sep 24 2004 - 12:02:07 EST


On Gwe, 2004-09-24 at 17:18, Ryan Arnold wrote:
> 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()?

At the moment if the user types a character and the line discipline
echoes it then you can get a write call to the driver. N_TTY tends to do
this one. When we close the ldisc first this should go away, but we
aren't quite there yet.

> > 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.

Ok so this probably is a close v open->hangup race. In which case it
shouldn't be too hard to fix now the first locking work is done. Until
then the change you suggest makes sense. I'll investigate that race in
more detail however because close() v open() and close cancelling the
workqueue for hangup ought to be stopping it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/