]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
serial: core: lock port for stop_rx() in uart_suspend_port()
authorJohn Ogness <john.ogness@linutronix.de>
Thu, 25 May 2023 09:31:53 +0000 (11:37 +0206)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:56 +0000 (17:19 +0200)
BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit abcb0cf1f5b2d99b1d117a4dbce334120e358d6d ]

The uarts_ops stop_rx() callback expects that the port->lock is
taken and interrupts are disabled.

Fixes: c9d2325cdb92 ("serial: core: Do stop_rx in suspend path for console if console_suspend is disabled")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230525093159.223817-3-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/tty/serial/serial_core.c

index eea526d34fdda48cd877ff8aafb3426febfcb845..9e734924c54a3670154ae955f138e1a182800d1a 100644 (file)
@@ -2337,8 +2337,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
         * able to Re-start_rx later.
         */
        if (!console_suspend_enabled && uart_console(uport)) {
-               if (uport->ops->start_rx)
+               if (uport->ops->start_rx) {
+                       spin_lock_irq(&uport->lock);
                        uport->ops->stop_rx(uport);
+                       spin_unlock_irq(&uport->lock);
+               }
                goto unlock;
        }