Re: [PATCH] tty_ldisc: Fix BUG() on hangup

From: Alan Cox
Date: Tue Oct 26 2010 - 12:14:47 EST


On Tue, 26 Oct 2010 17:49:03 +0200
Philippe Rétornaz <philippe.retornaz@xxxxxxx> wrote:

> Hello
>
> A kernel BUG when bluetooth rfcomm connection drop while
> the associated serial port is open is sometime triggered.
>
> It seems that the line discipline can disappear between the tty_ldisc_put and
> tty_ldisc_get. This patch fall back to the N_TTY line discipline if the
> previous discipline is not available anymore.
>
> This seem to fix the BUG(), but I don't know if it's correct.

I can see what you are trying to handle, and in theory you could if you
unload modules as they go unused hit a race there - I'm amazed it's
possible however.

The first part looks right - grab the reference before changing over and
error if it isn't available, and the second part follows logically,
although that bit of the hangup code is looking even more untidy now.

Acked-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
--
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/