提交 a5a2b130 编写于 作者: A Andy Shevchenko 提交者: Greg Kroah-Hartman

serial: core: fix potential NULL pointer dereference

The commit 761ed4a9 ("tty: serial_core: convert uart_close to use
tty_port_close") refactored uart_close() to use tty_port_close().  At the same
time it introduced a potential NULL pointer dereference. Rearrange the code to
avoid kernel crash.

Fixes: 761ed4a9 ("tty: serial_core: convert uart_close to use tty_port_close")
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0ae9fdef
......@@ -1484,15 +1484,15 @@ static void uart_tty_port_shutdown(struct tty_port *port)
struct uart_state *state = container_of(port, struct uart_state, port);
struct uart_port *uport = uart_port_check(state);
spin_lock_irq(&uport->lock);
/*
* At this point, we stop accepting input. To do this, we
* disable the receive line status interrupts.
*/
WARN(!uport, "detached port still initialized!\n");
if (WARN(!uport, "detached port still initialized!\n"))
return;
spin_lock_irq(&uport->lock);
uport->ops->stop_rx(uport);
spin_unlock_irq(&uport->lock);
uart_port_shutdown(port);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册