Commit 960fc49f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix oops in driver/serial/core.c

From: hugang <hugang@soulinfo.com>

It has a rather blatant null pointer deref and attempted memory leak.
parent 14a64515
...@@ -2189,11 +2189,11 @@ int uart_register_driver(struct uart_driver *drv) ...@@ -2189,11 +2189,11 @@ int uart_register_driver(struct uart_driver *drv)
void uart_unregister_driver(struct uart_driver *drv) void uart_unregister_driver(struct uart_driver *drv)
{ {
struct tty_driver *p = drv->tty_driver; struct tty_driver *p = drv->tty_driver;
drv->tty_driver = NULL;
tty_unregister_driver(p); tty_unregister_driver(p);
kfree(drv->state); kfree(drv->state);
kfree(drv->tty_driver->termios); kfree(p->termios);
kfree(drv->tty_driver); kfree(p);
drv->tty_driver = NULL;
} }
struct tty_driver *uart_console_device(struct console *co, int *index) struct tty_driver *uart_console_device(struct console *co, int *index)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment