From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 070D545C70B; Tue, 25 Aug 2026 13:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787666359; cv=none; b=MABT0HZIUo3nrknTF0KQUodrRAKo0Ofe8/v6NkWqz8jd3/Beer9ca5fBdZ960+uG4dze3Pvf1E7DHZe5pjzvjmrMEJDPzbLa/qFyQPQIxu7gDZHfVFSPUm9bMfof77bwXWIvMUDm+G5mE/PGtO03WA41bwbbfX3JlTzSE3WinzQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787666359; c=relaxed/simple; bh=xq77S8FYQyCTo2uLpRQU9m9ovSBCwrD1zCm915A4GeI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sQ8j0b1tpnZCcsduedlMPH951bMp6nJcvx4P5SMupl1JYPngn+OEHX990YQh40olZovJY+m6LOogSHwJc41/TxLRZ41nwuim9xausbgFWKQEwR23rY+4qsZOczhh5xxl09B6c0SeKYGnkrOVAj3L2Xc4u60vNw1V+6oJxhgGeHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2cdfwagZ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2cdfwagZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DF3F1F000E9; Tue, 25 Aug 2026 13:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787666356; bh=0D2XpAsjxL1caxaKtNB0nFTQ9fEp3ykCGjuubsyln1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2cdfwagZeWjVx31xXJqU3ZymOpwo+nqfY4Wnk/OI/VTRFqJKhLUbnS0tBdZuD1BsO l6ielthmJ588DyO08NM7bYBZ4mfb3e2QGnCHxIBZ6KI96yazusgWXUsLNWn+x+eJEo SqDsrahZo/H25waBANjLQqZnKP5AAP2zZO/KTe/o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Fan Wu , Sasha Levin Subject: [PATCH 5.10 16/57] serial: amba-pl011: synchronize DMA teardown Date: Tue, 25 Aug 2026 15:26:38 +0200 Message-ID: <20260825132541.923954818@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.342390421@linuxfoundation.org> References: <20260825132541.342390421@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fan Wu [ 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. Fixes: ead76f329f77 ("ARM: 6763/1: pl011: add optional RX DMA to PL011 v2") Cc: stable Assisted-by: Codex:gpt-5.6 Signed-off-by: Fan Wu Link: https://patch.msgid.link/20260731085915.326775-4-fanwu01@zju.edu.cn Signed-off-by: Greg Kroah-Hartman [ changed upstream's `timer_delete_sync()` deletion to match this tree's `del_timer_sync()` spelling at the old call site ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/amba-pl011.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1196,7 +1196,7 @@ static void pl011_dma_shutdown(struct ua 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, @@ -1209,12 +1209,12 @@ static void pl011_dma_shutdown(struct ua } 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; } }