From 66ba1209bf12aebd8969856dd3e2d0ecec3283b9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: May 25 2023 07:19:34 +0000 Subject: serial: 8250: Reinit port->pm on port specific driver unbind (git-fixes). --- diff --git a/patches.suse/serial-8250-Reinit-port-pm-on-port-specific-driver-u.patch b/patches.suse/serial-8250-Reinit-port-pm-on-port-specific-driver-u.patch new file mode 100644 index 0000000..2435a6d --- /dev/null +++ b/patches.suse/serial-8250-Reinit-port-pm-on-port-specific-driver-u.patch @@ -0,0 +1,56 @@ +From 04e82793f068d2f0ffe62fcea03d007a8cdc16a7 Mon Sep 17 00:00:00 2001 +From: Tony Lindgren +Date: Tue, 18 Apr 2023 13:14:06 +0300 +Subject: [PATCH] serial: 8250: Reinit port->pm on port specific driver unbind +Git-commit: 04e82793f068d2f0ffe62fcea03d007a8cdc16a7 +Patch-mainline: v6.4-rc1 +References: git-fixes + +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 +Link: https://lore.kernel.org/r/20230418101407.12403-1-tony@atomide.com +Signed-off-by: Greg Kroah-Hartman +Acked-by: Takashi Iwai + +--- + drivers/tty/serial/8250/8250_core.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c +index ab63c308be0a..13bf535eedcd 100644 +--- a/drivers/tty/serial/8250/8250_core.c ++++ b/drivers/tty/serial/8250/8250_core.c +@@ -1158,6 +1158,7 @@ void serial8250_unregister_port(int line) + uart->port.type = PORT_UNKNOWN; + uart->port.dev = &serial8250_isa_devs->dev; + uart->capabilities = 0; ++ serial8250_init_port(uart); + serial8250_apply_quirks(uart); + uart_add_one_port(&serial8250_reg, &uart->port); + } else { +-- +2.35.3 + diff --git a/series.conf b/series.conf index ba170aa..6717e8f 100644 --- a/series.conf +++ b/series.conf @@ -19993,6 +19993,7 @@ patches.suse/tty-Prevent-writing-chars-during-tcsetattr-TCSADRAIN.patch patches.suse/tty-serial-fsl_lpuart-adjust-buffer-length-to-the-in.patch patches.suse/serial-8250-Add-missing-wakeup-event-reporting.patch + patches.suse/serial-8250-Reinit-port-pm-on-port-specific-driver-u.patch patches.suse/drivers-staging-rtl8723bs-Fix-locking-in-_rtw_join_t.patch patches.suse/drivers-staging-rtl8723bs-Fix-locking-in-rtw_scan_ti.patch patches.suse/staging-iio-resolver-ads1210-fix-config-mode.patch