From: sashiko-bot@kernel.org
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH] spi: fsl-lpspi: replace dmaengine_terminate_all with dmaengine_terminate_sync
Date: Tue, 19 May 2026 11:03:58 +0000 [thread overview]
Message-ID: <20260519110358.A67EEC2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519104517.2794390-1-carlos.song@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Missing termination of the active RX DMA channel when TX DMA preparation fails, leading to potential memory corruption.
--
commit ec7592d39a6caaca48276f43db4b9a0f4fa50bfd
Author: Carlos Song <carlos.song@nxp.com>
spi: fsl-lpspi: replace dmaengine_terminate_all with dmaengine_terminate_sync
This commit replaces the deprecated dmaengine_terminate_all() API with
dmaengine_terminate_sync() in the fsl-lpspi driver.
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index e201309f8aae3..1a94a42fac319 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
[ ... ]
> @@ -647,7 +647,7 @@ static int fsl_lpspi_dma_transfer(struct spi_controller *controller,
> tx->sgl, tx->nents, DMA_MEM_TO_DEV,
> DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> if (!desc_tx) {
> - dmaengine_terminate_all(controller->dma_tx);
> + dmaengine_terminate_sync(controller->dma_tx);
Because controller->dma_rx was already submitted and issued just prior to
preparing desc_tx, does this error path also need to terminate the RX
channel?
If dmaengine_prep_slave_sg fails for the TX channel and the driver returns
-EINVAL, the SPI core will abort the transfer and unmap the buffers. Since
controller->dma_rx is still running, could this cause the DMA controller to
write to freed or unmapped memory?
This wasn't introduced by your patch, but modifying this exact error path
might be a good opportunity to fix the missing RX channel cleanup.
> return -EINVAL;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260519104517.2794390-1-carlos.song@oss.nxp.com?part=1
prev parent reply other threads:[~2026-05-19 11:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 10:45 [PATCH] spi: fsl-lpspi: replace dmaengine_terminate_all with dmaengine_terminate_sync Carlos Song (OSS)
2026-05-19 11:03 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260519110358.A67EEC2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.