All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Golla Nagendra" <nagendra.golla@amd.com>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments
Date: Thu, 06 Aug 2026 12:42:22 +0000	[thread overview]
Message-ID: <20260806124223.26A8A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806123014.2120447-4-nagendra.golla@amd.com>

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

Pre-existing issues:
- [High] Double-free and list corruption due to dropping the lock during safe list traversal in zynqmp_dma_chan_desc_cleanup.
--

--- Patch [3]: [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments ---
commit 3c8d64c77aae165a12708426042a7a72be1ba044
Author: Golla Nagendra <nagendra.golla@amd.com>

dmaengine: zynqmp_dma: Fix stale kerneldoc comments

This commit updates various kerneldoc comments across the zynqmp_dma driver.
It corrects parameter descriptions and return values that no longer matched
the actual code implementation.

> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index f7e4a177bd17e..c5b05fd52e9d8 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 can dropping the lock during safe list
traversal in zynqmp_dma_chan_desc_cleanup() cause a double-free or list
corruption?

If CPU1 is running zynqmp_dma_chan_desc_cleanup(), it drops chan->lock
to invoke the callback:

	list_for_each_entry_safe(desc, next, &chan->done_list, node) {
		...
		if (dmaengine_desc_callback_valid(&cb)) {
			spin_unlock_irqrestore(&chan->lock, irqflags);
			dmaengine_desc_callback_invoke(&cb, NULL);
			spin_lock_irqsave(&chan->lock, irqflags);
		}

While the lock is dropped, if a concurrent call to
zynqmp_dma_device_terminate_all() on CPU2 acquires the lock and frees
the descriptors, it would move all items from done_list to free_list.

When CPU1 reacquires the lock, it calls zynqmp_dma_free_descriptor(chan, desc)
on the already freed desc. This would double-increment chan->desc_free_cnt.
Furthermore, the loop would continue using the cached next pointer which
is now part of the free_list, potentially causing it to traverse the wrong
list and process freed descriptors.

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

  reply	other threads:[~2026-08-06 12:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 12:30 [PATCH 0/6] dmaengine: zynqmp_dma: Fix error paths and follow-up cleanups Golla Nagendra
2026-08-06 12:30 ` [PATCH 1/6] dmaengine: zynqmp_dma: Fix alloc_chan_resources error cleanup Golla Nagendra
2026-08-06 12:48   ` sashiko-bot
2026-08-06 15:39   ` Frank Li
2026-08-06 12:30 ` [PATCH 2/6] dmaengine: zynqmp_dma: Fix chan probe error handling Golla Nagendra
2026-08-06 12:51   ` sashiko-bot
2026-08-06 15:48   ` Frank Li
2026-08-06 12:30 ` [PATCH 3/6] dmaengine: zynqmp_dma: Fix stale kerneldoc comments Golla Nagendra
2026-08-06 12:42   ` sashiko-bot [this message]
2026-08-06 15:49   ` Frank Li
2026-08-06 12:30 ` [PATCH 4/6] dmaengine: zynqmp_dma: Fix minor whitespace Golla Nagendra
2026-08-06 12:41   ` sashiko-bot
2026-08-06 15:53   ` Frank Li
2026-08-06 12:30 ` [PATCH 5/6] dmaengine: zynqmp_dma: Reject zero-length memcpy transfers Golla Nagendra
2026-08-06 12:44   ` sashiko-bot
2026-08-06 15:56   ` Frank Li
2026-08-07 11:02     ` Golla, Nagendra
2026-08-06 12:30 ` [PATCH 6/6] dmaengine: zynqmp_dma: Remove unused define and duplicate IRQ bit Golla Nagendra
2026-08-06 16:00   ` 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=20260806124223.26A8A1F000E9@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 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.