Re: tty locking again :)

From: Alan Cox
Date: Fri Nov 04 2005 - 08:01:58 EST


On Gwe, 2005-11-04 at 18:03 +1100, Benjamin Herrenschmidt wrote:
> I noticed that there doesn't seem to be any kind of locking in
> tty_(un)register_driver. It can very easily race with tty_open() doing a
> get_tty_driver(). Shouldn't tty_(un)register_driver be changed to take
> the tty_sem at least while manipulating the list ?

Its totally racy. Its on the todo list but I'm waiting for the buffering
changes to get into the Linus kernel and tested before doing the next
chunk of work on it (firstly fixing the rx/tx locking, then removing
TTY_DONT_FLIP which is a precursor to sanity for polled serial devices
and DMA)

> I noticed that while chasing a different bug (a driver bug actually),
> but I don't see how we are protected here. And considering the race I
> found in the driver, I tend to think we aren't protected at all

It all needs considerable work. Fixing the receive/transmit locking is
IMHO by far the most important however now the buffers are done.

Alan

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