Re: Race condition in tty_flip_buffer_push/flush_to_ldisc?

From: Martin Buck (mb-kernel0212@gromit.dyndns.org)
Date: Tue Dec 03 2002 - 12:23:10 EST


On Tue, Dec 03, 2002 at 11:02:12AM -0500, Stuart MacDonald wrote:
> What causes the DONT_FLIP bit to be un/set? I don't think your
> situation can occur under normal operation. But ICBW.

n_tty.c seems to do it in read_chan(), i.e. it will happen when the
process reading from the TTY is currently in read(2) while at the same time
new characters arrive on the serial port.

> If you search the lkml archive, recently Ted stated that it's
> acceptable to call the line discpline's receive_buf() routine
> directly, bypassing the flip buffers.

Interesting, that should solve my problem. But then the next question is:
What's the use of the DONT_FLIP bit if it's legal to bypass it by calling
receive_buf() directly?

Also, if somebody enables low_latency using setserial with the standard
serial driver, he can still trigger the race condition. It's not very
likely to happen, but it does happen - I added code to flush_to_ldisc() to
detect concurrent calls and it triggered once during an over-night test.

Thanks,
Martin

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



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:16 EST