Re: [PATCH] hvc_console fix to protect hvc_write against ldisc write after hvc_close

From: Theodore Ts'o
Date: Wed Sep 15 2004 - 15:58:08 EST


On Wed, Sep 15, 2004 at 01:43:55PM -0500, Ryan Arnold wrote:
> Andrew,
>
> Due to the tty ldisc code not stopping write operations against a driver
> even after a tty has been closed I added a mechanism to hvc_console in
> my previous patch to prevent this by nulling out the tty->driver_data in
> hvc_close() but I forgot to check tty->driver_data in hvc_write().
> Anton Blanchard got several oops'es from hvc_write() accessing NULL as
> if it were a pointer to an hvc_struct usually stored in
> tty->driver_data.
>
> So this patch checks tty->driver_data in hvc_write() before it is used.
> Hopefully once Alan Cox's patch is checked in ldisc writes won't
> continue to happen after tty closes.

The current (I can't speak to what Alan Cox is going to change) rules
with tty drivers is that tty drivers are supposed to close the line
discpline in their close routines. That's the much safer and cleaner
way of fixing this problem, and it is in line with what most of the
other tty drivers are doing.

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