]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
serial: qcom-geni: fix shutdown race
authorJohan Hovold <johan+linaro@kernel.org>
Wed, 9 Oct 2024 14:51:04 +0000 (16:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Oct 2024 06:39:23 +0000 (08:39 +0200)
A commit adding back the stopping of tx on port shutdown failed to add
back the locking which had also been removed by commit e83766334f96
("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART
shutdown").

Holding the port lock is needed to serialise against the console code,
which may update the interrupt enable register and access the port
state.

Fixes: d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown")
Fixes: 947cc4ecc06c ("serial: qcom-geni: fix soft lockup on sw flow control and suspend")
Cc: stable@vger.kernel.org # 6.3
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20241009145110.16847-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/qcom_geni_serial.c

index 2e4a5361f13728281ebb2937fbc28d2700d23927..87cd974b76bf83e6f39d2fcc5f2660deaac154a4 100644 (file)
@@ -1114,10 +1114,12 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport)
 {
        disable_irq(uport->irq);
 
+       uart_port_lock_irq(uport);
        qcom_geni_serial_stop_tx(uport);
        qcom_geni_serial_stop_rx(uport);
 
        qcom_geni_serial_cancel_tx_cmd(uport);
+       uart_port_unlock_irq(uport);
 }
 
 static void qcom_geni_serial_flush_buffer(struct uart_port *uport)