* [PATCH backport to 5.4 and below 1/1] serial: 8250: Flush DMA Rx on RLSI
@ 2022-11-21 12:49 Ilpo Järvinen
2022-11-22 12:40 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2022-11-21 12:49 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Andy Shevchenko, stable
[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]
commit 1980860e0c8299316cddaf0992dd9e1258ec9d88 upstream.
Returning true from handle_rx_dma() without flushing DMA first creates
a data ordering hazard. If DMA Rx has handled any character at the
point when RLSI occurs, the non-DMA path handles any pending characters
jumping them ahead of those characters that are pending under DMA.
Fixes: 75df022b5f89 ("serial: 8250_dma: Fix RX handling")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221108121952.5497-5-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/8250/8250_port.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 97a64bc79350..b47335dfae16 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1824,10 +1824,9 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
if (!up->dma->rx_running)
break;
fallthrough;
+ case UART_IIR_RLSI:
case UART_IIR_RX_TIMEOUT:
serial8250_rx_dma_flush(up);
- /* fall-through */
- case UART_IIR_RLSI:
return true;
}
return up->dma->rx_dma(up);
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH backport to 5.4 and below 1/1] serial: 8250: Flush DMA Rx on RLSI
2022-11-21 12:49 [PATCH backport to 5.4 and below 1/1] serial: 8250: Flush DMA Rx on RLSI Ilpo Järvinen
@ 2022-11-22 12:40 ` Greg Kroah-Hartman
2022-11-22 13:14 ` [PATCH backport to 4.19 " Ilpo Järvinen
0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-11-22 12:40 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Andy Shevchenko, stable
On Mon, Nov 21, 2022 at 02:49:25PM +0200, Ilpo Järvinen wrote:
> commit 1980860e0c8299316cddaf0992dd9e1258ec9d88 upstream.
>
> Returning true from handle_rx_dma() without flushing DMA first creates
> a data ordering hazard. If DMA Rx has handled any character at the
> point when RLSI occurs, the non-DMA path handles any pending characters
> jumping them ahead of those characters that are pending under DMA.
>
> Fixes: 75df022b5f89 ("serial: 8250_dma: Fix RX handling")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Link: https://lore.kernel.org/r/20221108121952.5497-5-ilpo.jarvinen@linux.intel.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/tty/serial/8250/8250_port.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied to 5.4.y only. Fails to apply to 4.9.y, 4.14.y, or 4.19.y :(
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH backport to 4.19 and below 1/1] serial: 8250: Flush DMA Rx on RLSI
2022-11-22 12:40 ` Greg Kroah-Hartman
@ 2022-11-22 13:14 ` Ilpo Järvinen
2022-11-22 15:34 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2022-11-22 13:14 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Andy Shevchenko, stable
[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]
commit 1980860e0c8299316cddaf0992dd9e1258ec9d88 upstream.
Returning true from handle_rx_dma() without flushing DMA first creates
a data ordering hazard. If DMA Rx has handled any character at the
point when RLSI occurs, the non-DMA path handles any pending characters
jumping them ahead of those characters that are pending under DMA.
Fixes: 75df022b5f89 ("serial: 8250_dma: Fix RX handling")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221108121952.5497-5-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/tty/serial/8250/8250_port.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index cab3a74281ef..8aee43fe488a 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1802,10 +1802,9 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
if (!up->dma->rx_running)
break;
/* fall-through */
+ case UART_IIR_RLSI:
case UART_IIR_RX_TIMEOUT:
serial8250_rx_dma_flush(up);
- /* fall-through */
- case UART_IIR_RLSI:
return true;
}
return up->dma->rx_dma(up);
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH backport to 4.19 and below 1/1] serial: 8250: Flush DMA Rx on RLSI
2022-11-22 13:14 ` [PATCH backport to 4.19 " Ilpo Järvinen
@ 2022-11-22 15:34 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-11-22 15:34 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Andy Shevchenko, stable
On Tue, Nov 22, 2022 at 03:14:10PM +0200, Ilpo Järvinen wrote:
> commit 1980860e0c8299316cddaf0992dd9e1258ec9d88 upstream.
>
> Returning true from handle_rx_dma() without flushing DMA first creates
> a data ordering hazard. If DMA Rx has handled any character at the
> point when RLSI occurs, the non-DMA path handles any pending characters
> jumping them ahead of those characters that are pending under DMA.
>
> Fixes: 75df022b5f89 ("serial: 8250_dma: Fix RX handling")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Link: https://lore.kernel.org/r/20221108121952.5497-5-ilpo.jarvinen@linux.intel.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/tty/serial/8250/8250_port.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index cab3a74281ef..8aee43fe488a 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1802,10 +1802,9 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
> if (!up->dma->rx_running)
> break;
> /* fall-through */
> + case UART_IIR_RLSI:
> case UART_IIR_RX_TIMEOUT:
> serial8250_rx_dma_flush(up);
> - /* fall-through */
> - case UART_IIR_RLSI:
> return true;
> }
> return up->dma->rx_dma(up);
> --
> 2.30.2
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-22 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 12:49 [PATCH backport to 5.4 and below 1/1] serial: 8250: Flush DMA Rx on RLSI Ilpo Järvinen
2022-11-22 12:40 ` Greg Kroah-Hartman
2022-11-22 13:14 ` [PATCH backport to 4.19 " Ilpo Järvinen
2022-11-22 15:34 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox