Commit 59debc62 authored by Russell King's avatar Russell King

[SERIAL] Fix missing NULL check

tty->driver_data or state->port may end up being NULL in uart_close.
Make sure that we correctly clean up in this case, rather than
oopsing.
parent 811a9c61
......@@ -1208,9 +1208,15 @@ static void uart_set_termios(struct tty_struct *tty, struct termios *old_termios
static void uart_close(struct tty_struct *tty, struct file *filp)
{
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->port;
struct uart_port *port;
BUG_ON(!kernel_locked());
if (!state || !state->port)
return;
port = state->port;
DPRINTK("uart_close(%d) called\n", port->line);
down(&state->sem);
......
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