FAILED: patch "[PATCH] serial: amba-pl011: synchronize DMA teardown" failed to apply to 6.1-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 440915499231e9db1c361aa45bb702e8fd3b4a32
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026081745-polygraph-envy-e793@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 440915499231e9db1c361aa45bb702e8fd3b4a32 Mon Sep 17 00:00:00 2001
From: Fan Wu <[email protected]>
Date: Fri, 31 Jul 2026 08:59:15 +0000
Subject: [PATCH] serial: amba-pl011: synchronize DMA teardown
dmaengine_terminate_all() does not wait for a running callback, so the TX callback can still touch the TX buffer after it is freed. The RX poll timer reads the RX buffers without the port lock.
Switch to dmaengine_terminate_sync() and delete the RX timer before freeing the buffers.
drivers/tty/serial/amba-pl011.c +4 -4
@@ -1247,7 +1247,7 @@ static void pl011_dma_shutdown(struct uart_amba_port *uap)if (uap->using_tx_dma) {/* In theory, this should already be done by pl011_dma_flush_buffer */ -dmaengine_terminate_all (uap->dmatx.chan); +dmaengine_terminate_sync (uap->dmatx.chan);if (uap->dmatx.queued) { dma_unmap_single(uap->dmatx.chan->device->dev, uap->dmatx.dma, uap->dmatx.len,
@@ -1260,12 +1260,12 @@ static void pl011_dma_shutdown(struct uart_amba_port *uap) }if (uap->using_rx_dma) { -dmaengine_terminate_all (uap->dmarx.chan); +if (uap->dmarx.poll_rate) +timer_delete_sync (&uap->dmarx.timer); +dmaengine_terminate_sync (uap->dmarx.chan);/* Clean up the RX DMA */ pl011_dmabuf_free (uap->dmarx.chan, &uap->dmarx.dbuf_a,DMA_FROM_DEVICE );pl011_dmabuf_free (uap->dmarx.chan, &uap->dmarx.dbuf_b,DMA_FROM_DEVICE ); -if (uap->dmarx.poll_rate) -timer_delete_sync (&uap->dmarx.timer); uap->using_rx_dma = false; } }
Sasha Levin
maintainerPATCH 1/1 serial: amba-pl011: synchronize DMA teardown
From: Fan Wu <[email protected]>
[ Upstream commit 440915499231e9db1c361aa45bb702e8fd3b4a32 ]
dmaengine_terminate_all() does not wait for a running callback, so the TX callback can still touch the TX buffer after it is freed. The RX poll timer reads the RX buffers without the port lock.
Switch to dmaengine_terminate_sync() and delete the RX timer before freeing the buffers.
--- drivers/tty/serial/amba-pl011.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/amba-pl011.c +4 -4
@@ -1193,7 +1193,7 @@ static void pl011_dma_shutdown(struct uart_amba_port *uap)if (uap->using_tx_dma) {/* In theory, this should already be done by pl011_dma_flush_buffer */ -dmaengine_terminate_all (uap->dmatx.chan); +dmaengine_terminate_sync (uap->dmatx.chan);if (uap->dmatx.queued) { dma_unmap_single(uap->dmatx.chan->device->dev, uap->dmatx.dma, uap->dmatx.len,
@@ -1206,12 +1206,12 @@ static void pl011_dma_shutdown(struct uart_amba_port *uap) }if (uap->using_rx_dma) { -dmaengine_terminate_all (uap->dmarx.chan); +if (uap->dmarx.poll_rate) +timer_delete_sync (&uap->dmarx.timer); +dmaengine_terminate_sync (uap->dmarx.chan);/* Clean up the RX DMA */ pl011_dmabuf_free (uap->dmarx.chan, &uap->dmarx.dbuf_a,DMA_FROM_DEVICE );pl011_dmabuf_free (uap->dmarx.chan, &uap->dmarx.dbuf_b,DMA_FROM_DEVICE ); -if (uap->dmarx.poll_rate) -del_timer_sync (&uap->dmarx.timer); uap->using_rx_dma = false; } }
Signature · 1 line
2.53.0