DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Golla Nagendra" <nagendra.golla@amd.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH V2 4/8] dmaengine: zynqmp_dma: Fix stale kerneldoc comments
Date: Fri, 14 Aug 2026 05:12:29 +0000	[thread overview]
Message-ID: <20260814051230.471271F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814045616.1661199-5-nagendra.golla@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Race condition causing list corruption and double-frees in `zynqmp_dma_chan_desc_cleanup()` when client callbacks terminate transfers.
- [High] PM runtime usage counter leak in `zynqmp_dma_probe()` error paths.
--

--- Patch [4]: [PATCH V2 4/8] dmaengine: zynqmp_dma: Fix stale kerneldoc comments ---
commit 50bd84a068af6c47ff8d29181173cde44baa590d
Author: Golla Nagendra <nagendra.golla@amd.com>

dmaengine: zynqmp_dma: Fix stale kerneldoc comments

Correct kerneldoc comments that no longer matched the code.

> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index 22b517c570038..a2fbefbb43b65 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c

[ ... ]

> @@ -617,7 +617,6 @@ static void zynqmp_dma_start_transfer(struct zynqmp_dma_chan *chan)
>  	zynqmp_dma_start(chan);
>  }
>  
> -
>  /**
>   * zynqmp_dma_chan_desc_cleanup - Cleanup the completed descriptors
>   * @chan: ZynqMP DMA channel

[Severity: High]
This is a pre-existing issue, but could there be a race condition in
zynqmp_dma_chan_desc_cleanup() if the client callback terminates the transfer?

When iterating over chan->done_list with list_for_each_entry_safe(), the lock
is dropped before invoking the callback:

	spin_unlock_irqrestore(&chan->lock, irqflags);
	dmaengine_desc_callback_invoke(&cb, NULL);
	spin_lock_irqsave(&chan->lock, irqflags);

If the client callback calls dmaengine_terminate_all(), it acquires the lock,
empties the done_list, and moves pending descriptors to the free_list.

When zynqmp_dma_chan_desc_cleanup() resumes, it will continue iterating using
the stale next pointer which now points into free_list. This could lead to a
double-free when zynqmp_dma_free_descriptor() is called.

[ ... ]

[Severity: High]
This is another pre-existing issue, but does zynqmp_dma_probe() leak a PM
runtime usage counter in its error paths?

If initialization fails after pm_runtime_resume_and_get(zdev->dev) succeeds,
the error path jumps to err_disable_pm:

drivers/dma/xilinx/zynqmp_dma.c:zynqmp_dma_probe() {
    ...
err_disable_pm:
	if (!pm_runtime_enabled(zdev->dev))
		zynqmp_dma_runtime_suspend(zdev->dev);
	pm_runtime_disable(zdev->dev);
	return ret;
}

It calls pm_runtime_disable(), but it doesn't seem to call
pm_runtime_put_noidle() to drop the usage counter acquired earlier.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260814045616.1661199-1-nagendra.golla@amd.com?part=4

  reply	other threads:[~2026-08-14  5:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14  4:56 [PATCH V2 0/8] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
2026-08-14  4:56 ` [PATCH V2 1/8] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Golla Nagendra
2026-08-14  5:13   ` sashiko-bot
2026-08-14  4:56 ` [PATCH V2 2/8] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v " Golla Nagendra
2026-08-14  5:14   ` sashiko-bot
2026-08-14  4:56 ` [PATCH V2 3/8] dmaengine: zynqmp_dma: Fix chan probe/remove error handling Golla Nagendra
2026-08-14  4:56 ` [PATCH V2 4/8] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
2026-08-14  5:12   ` sashiko-bot [this message]
2026-08-14  4:56 ` [PATCH V2 5/8] dmaengine: zynqmp_dma: Fix minor whitespace Golla Nagendra
2026-08-14  4:56 ` [PATCH V2 6/8] dmaengine: zynqmp_dma: Use of_dma_is_coherent for dma-coherent Golla Nagendra
2026-08-14  5:10   ` sashiko-bot
2026-08-14  4:56 ` [PATCH V2 7/8] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers Golla Nagendra
2026-08-14  4:56 ` [PATCH V2 8/8] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit Golla Nagendra

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=20260814051230.471271F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=nagendra.golla@amd.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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