Re: [PATCH 1/2] USB: serial/keyspan_pda, fix potential tty NULLdereferences

From: Alan Stern
Date: Mon Feb 28 2011 - 10:14:21 EST

On Mon, 28 Feb 2011, Jiri Slaby wrote:

> Make sure that we check the return value of tty_port_tty_get.
> Sometimes it may return NULL and we later dereference that.
> There are several places to check. For easier handling,
> tty_port_tty_get is moved directly to the palce where needed in
> keyspan_pda_rx_interrupt.
> Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
> Cc: Alan Cox <alan@xxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>

I wonder about these changes. Does it makes sense to add this checking
everywhere? A more reasonable approach might be to make sure that
tty_port_tty_get is never called in a context where it could return
NULL. Or would that involve just as much effort, making work routines
and so on check to see whether there's an open TTY device before doing
anything else?

Alan Stern

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at