diff options
author | Geert Uytterhoeven <geert+renesas@linux-m68k.org> | 2014-03-17 17:10:58 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-18 03:16:59 +0400 |
commit | 4c6d5b4d537fbdfa310295e7071c85b07783d245 (patch) | |
tree | d17076585759c5ba0a4d2f42cdc0f9f4c2588244 /drivers/tty | |
parent | 63e3ad3252695a2b8c01b6f6c225e4537af08b85 (diff) | |
download | linux-4c6d5b4d537fbdfa310295e7071c85b07783d245.tar.xz |
serial_core: Get a reference for port->tty in uart_remove_one_port()
Suggested-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/serial_core.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 203cb32638c3..3253905428ea 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2645,6 +2645,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) { struct uart_state *state = drv->state + uport->line; struct tty_port *port = &state->port; + struct tty_struct *tty; int ret = 0; BUG_ON(in_interrupt()); @@ -2673,8 +2674,11 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) */ tty_unregister_device(drv->tty_driver, uport->line); - if (port->tty) + tty = tty_port_tty_get(port); + if (tty) { tty_vhangup(port->tty); + tty_kref_put(tty); + } /* * If the port is used as a console, unregister it |