Re: The Serial Layer

From: Theodore Ts'o
Date: Thu Sep 09 2004 - 11:57:24 EST


On Tue, Sep 07, 2004 at 08:14:20PM +0100, Alan Cox wrote:
> On Maw, 2004-09-07 at 21:06, Arjan van de Ven wrote:
> > On Tue, 2004-09-07 at 20:49, Alan Cox wrote:
> > > Is anyone currently looking at fixing this before I start applying
> > > extreme violence ? In particular to start trying to do something about
> > > the races in TIOCSTI, line discipline setting, hangup v receive, drivers
> > > abusing the API and calling ldisc.receive_buf direct ?

Calling ldisc.receive_buf directly() should be OK as long as you're
not in an interrupt handler. (For example the comtrol driver polls in
a timer bottom-half, so it's OK to call ldisc.receive_buf).
Unfortunately, some drivers don't quite follow the rules.

> > don't you mean the TTY layer instead of the serial layer ?
>
> Both. A lot of hangup/receive races are in the serial drivers themselves
> doing things like
>
> hangup
> [close ldisc]
> send bytes to the ldisc
> [Boom!]

The hangup handling needs to be completely redone, so that we don't
force serial drivers to do a completely shutdown of the port in an
interrupt context. If the drivers are careful, it can be safe, but
it's too hard to handle hangup correctly.

If you have time to work on the tty layer (sucker!!!), please go ahead
and start work by all means. I was hoping to have time to clean up
some of the more egregious problems sometime next year (after I escape
back into development), but getting this fixed sooner rather the later
would be a definitely Good Thing.

- Ted
-
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/