Skip to content

Commit 2ca286c

Browse files
tmlindUlrich Hecht
authored andcommitted
serial: 8250: Reinit port->pm on port specific driver unbind
[ Upstream commit 04e8279 ] When we unbind a serial port hardware specific 8250 driver, the generic serial8250 driver takes over the port. After that we see an oops about 10 seconds later. This can produce the following at least on some TI SoCs: Unhandled fault: imprecise external abort (0x1406) Internal error: : 1406 [#1] SMP ARM Turns out that we may still have the serial port hardware specific driver port->pm in use, and serial8250_pm() tries to call it after the port specific driver is gone: serial8250_pm [8250_base] from uart_change_pm+0x54/0x8c [serial_base] uart_change_pm [serial_base] from uart_hangup+0x154/0x198 [serial_base] uart_hangup [serial_base] from __tty_hangup.part.0+0x328/0x37c __tty_hangup.part.0 from disassociate_ctty+0x154/0x20c disassociate_ctty from do_exit+0x744/0xaac do_exit from do_group_exit+0x40/0x8c do_group_exit from __wake_up_parent+0x0/0x1c Let's fix the issue by calling serial8250_set_defaults() in serial8250_unregister_port(). This will set the port back to using the serial8250 default functions, and sets the port->pm to point to serial8250_pm. Signed-off-by: Tony Lindgren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Sasha Levin <[email protected]> [uli: backport to 4.4] Signed-off-by: Ulrich Hecht <[email protected]>
1 parent 865113f commit 2ca286c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/tty/serial/8250/8250_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ void serial8250_unregister_port(int line)
10821082
uart->port.type = PORT_UNKNOWN;
10831083
uart->port.dev = &serial8250_isa_devs->dev;
10841084
uart->capabilities = 0;
1085+
serial8250_init_port(uart);
10851086
uart_add_one_port(&serial8250_reg, &uart->port);
10861087
} else {
10871088
uart->port.dev = NULL;

0 commit comments

Comments
 (0)