]> git.ipfire.org Git - thirdparty/kernel/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 May 2023 10:45:42 +0000 (11:45 +0100)
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>
drivers/tty/serial/serial_core.c

index 4b98d13555c06710ed23ec724475f417ee3eaecd..37ad53616372da3a8006a486af35504c12221731 100644 (file)
@@ -2333,8 +2333,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;
        }