mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 14:33:24 -04:00
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.
Fixes: ead76f329f ("ARM: 6763/1: pl011: add optional RX DMA to PL011 v2")
Cc: stable <stable@kernel.org>
Assisted-by: Codex:gpt-5.6
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Link: https://patch.msgid.link/20260731085915.326775-4-fanwu01@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
36672c8d7d
commit
4409154992
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user