mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Roland Dreier <rolanddreier@rivian.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
	Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] dmaengine: dw-axi-dmac: Bound the cyclic LLP search to the descriptor
Date: Wed, 21 Oct 2026 12:44:19 -0400	[thread overview]
Message-ID: <atjr446tJ1ECtdMk@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20261006-dw-axi-fixes-v1-1-3b319e456d93@rivian.com>

On Tue, Oct 06, 2026 at 01:03:07AM +0000, Roland Dreier wrote:
> For a cyclic transfer, axi_chan_block_xfer_complete() looks for the
> LLI whose address matches CH_LLP by walking the descriptor's hw_desc
> array, but it bounds the walk with chan->descs_allocated. That counts
> the LLIs of every descriptor allocated on the channel, not just this
> one. If CH_LLP matches none of the descriptor's LLIs (should never
> happen, but...) while another descriptor is allocated, the loop reads
> past the end of the array.
>
> Bound the walk with the descriptor's nr_hw_descs, as in the
> already-queued patch "dmaengine: dw-axi-dmac: Fix LLI dump
> out-of-bounds access".
>
> Assisted-by: LLM
> Signed-off-by: Roland Dreier <rolanddreier@rivian.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index eebed2474210..813d17a278e7 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -1095,7 +1095,6 @@ static noinline void axi_chan_handle_err(struct axi_dma_chan *chan, u32 status)
>
>  static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)
>  {
> -	int count = atomic_read(&chan->descs_allocated);
>  	struct axi_dma_hw_desc *hw_desc;
>  	struct axi_dma_desc *desc;
>  	struct virt_dma_desc *vd;
> @@ -1122,7 +1121,7 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan)
>  		desc = vd_to_axi_desc(vd);
>  		if (desc) {
>  			llp = lo_hi_readq(chan->chan_regs + CH_LLP);
> -			for (i = 0; i < count; i++) {
> +			for (i = 0; i < desc->nr_hw_descs; i++) {
>  				hw_desc = &desc->hw_desc[i];
>  				if (hw_desc->llp == llp) {
>  					axi_chan_irq_clear(chan, hw_desc->lli->status_lo);
>
> --
> 2.54.0
>

  reply	other threads:[~2026-10-21 16:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06  1:03 [PATCH 0/3] dmaengine: dw-axi-dmac: Fix LLP search, error reporting, and error dump Roland Dreier via B4 Relay
2026-10-06  1:03 ` [PATCH 1/3] dmaengine: dw-axi-dmac: Bound the cyclic LLP search to the descriptor Roland Dreier via B4 Relay
2026-10-21 16:44   ` Frank Li [this message]
2026-10-06  1:03 ` [PATCH 2/3] dmaengine: dw-axi-dmac: Report failed transfers in the descriptor result Roland Dreier via B4 Relay
2026-10-21 16:45   ` Frank Li
2026-10-06  1:03 ` [PATCH 3/3] dmaengine: dw-axi-dmac: Decode errors in the transfer failure log Roland Dreier via B4 Relay
2026-10-21 16:49   ` Frank Li

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=atjr446tJ1ECtdMk@lizhi-Precision-Tower-5810 \
    --to=frank.li@oss.nxp.com \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rolanddreier@rivian.com \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®