* [PATCH] serial: 8250_fsl: fix handle_irq locking
@ 2023-02-27 8:50 Johan Hovold
2023-02-28 6:27 ` Jiri Slaby
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2023-02-27 8:50 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, linux-serial, linux-kernel, Johan Hovold, stable,
Dan Carpenter
The 8250 handle_irq callback is not just called from the interrupt
handler but also from a timer callback when polling (e.g. for ports
without an interrupt line). Consequently the callback must explicitly
disable interrupts to avoid a potential deadlock with another interrupt
in polled mode.
Fix up the two paths in the freescale callback that failed to re-enable
interrupts when polling.
Fixes: 853a9ae29e97 ("serial: 8250: fix handle_irq locking")
Cc: stable@vger.kernel.org # 5.13
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y/xYzqp4ogmOF5t0@kili
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/tty/serial/8250/8250_fsl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c
index 8aad15622a2e..8adfaa183f77 100644
--- a/drivers/tty/serial/8250/8250_fsl.c
+++ b/drivers/tty/serial/8250/8250_fsl.c
@@ -34,7 +34,7 @@ int fsl8250_handle_irq(struct uart_port *port)
iir = port->serial_in(port, UART_IIR);
if (iir & UART_IIR_NO_INT) {
- spin_unlock(&up->port.lock);
+ spin_unlock_irqrestore(&up->port.lock, flags);
return 0;
}
@@ -42,7 +42,7 @@ int fsl8250_handle_irq(struct uart_port *port)
if (unlikely(up->lsr_saved_flags & UART_LSR_BI)) {
up->lsr_saved_flags &= ~UART_LSR_BI;
port->serial_in(port, UART_RX);
- spin_unlock(&up->port.lock);
+ spin_unlock_irqrestore(&up->port.lock, flags);
return 1;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] serial: 8250_fsl: fix handle_irq locking
2023-02-27 8:50 [PATCH] serial: 8250_fsl: fix handle_irq locking Johan Hovold
@ 2023-02-28 6:27 ` Jiri Slaby
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2023-02-28 6:27 UTC (permalink / raw)
To: Johan Hovold, Greg Kroah-Hartman
Cc: linux-serial, linux-kernel, stable, Dan Carpenter
On 27. 02. 23, 9:50, Johan Hovold wrote:
> The 8250 handle_irq callback is not just called from the interrupt
> handler but also from a timer callback when polling (e.g. for ports
> without an interrupt line). Consequently the callback must explicitly
> disable interrupts to avoid a potential deadlock with another interrupt
> in polled mode.
>
> Fix up the two paths in the freescale callback that failed to re-enable
> interrupts when polling.
Huh.
Acked-by: Jiri Slaby <jirislaby@kernel.org>
--
js
suse labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-28 6:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 8:50 [PATCH] serial: 8250_fsl: fix handle_irq locking Johan Hovold
2023-02-28 6:27 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox