From: Alan Cox Date: Mon, 14 May 2012 13:51:22 +0000 (+0100) Subject: tty: Allow uart_register/unregister/register X-Git-Tag: v3.2.19~59 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b89d788669db009d58b2f5e9988caaaf7df9e4ab;p=karo-tx-linux.git tty: Allow uart_register/unregister/register commit 1e66cded334e6cea596c72f6f650eec351b1e959 upstream. This is legitimate but because we don't clear the drv->state pointer in the unregister code causes a bogus BUG(). Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=42880 Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 0406d7ff505e..af5ffb9154d4 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2305,6 +2305,7 @@ void uart_unregister_driver(struct uart_driver *drv) tty_unregister_driver(p); put_tty_driver(p); kfree(drv->state); + drv->state = NULL; drv->tty_driver = NULL; }