From: sashiko-bot@kernel.org
To: "Wolfram Sang" <wsa+renesas@sang-engineering.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH 5/8] dmaengine: mv_xor_v2: unmap descriptor before completing cookie
Date: Sat, 10 Oct 2026 12:54:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-166552@kernel.org> (raw)
In-Reply-To: <20261010124348.19055-6-wsa+renesas@sang-engineering.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] dmaengine: UAF race from calling dmaengine_desc_get_callback_invoke late
--
commit 8c7213cd37abe1e50d7719fbacf46e143cda1fb6
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
dmaengine: mv_xor_v2: unmap descriptor before completing cookie
To ensure that buffers are flushed, make sure that the descriptor gets
unmapped before completing the cookie.
Link: https://lore.kernel.org/r/20261009093745.539924-1-vkoul@kernel.org
> diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c
> index cad4d4fb51ac3..8a307431721fc 100644
> --- a/drivers/dma/mv_xor_v2.c
> +++ b/drivers/dma/mv_xor_v2.c
> @@ -581,9 +581,8 @@ static void mv_xor_v2_tasklet(struct tasklet_struct *t)
> * lock is required the IMSG threshold provide
> * the locking
> */
> - dma_cookie_complete(&next_pending_sw_desc->async_tx);
> -
> dma_descriptor_unmap(&next_pending_sw_desc->async_tx);
> + dma_cookie_complete(&next_pending_sw_desc->async_tx);
> dmaengine_desc_get_callback_invoke(
> &next_pending_sw_desc->async_tx, NULL);
> }
[Severity: High]
Does completing the cookie before extracting the callback information create a
use-after-free race condition?
dma_cookie_complete() updates tx->chan->completed_cookie, which makes the DMA
transaction completion visible to clients polling via dma_async_is_tx_complete().
After completion is signaled, clients are legally allowed to free the callback
context (callback_param), recycle resources, or even unload the module
containing the callback function.
If a polling client races and frees the resources immediately after seeing
completion, the subsequent call to dmaengine_desc_get_callback_invoke() could
dereference a freed callback_param or jump to unmapped module memory.
Should the callback information be cached using dmaengine_desc_get_callback()
before calling dma_cookie_complete(), and then invoked via
dmaengine_desc_callback_invoke() afterwards?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261010124348.19055-1-wsa+renesas@sang-engineering.com?part=5
next prev parent reply other threads:[~2026-10-10 12:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 12:43 [PATCH 0/8] dmaengine: unmap descriptor before completing cookie Wolfram Sang
2026-10-10 12:43 ` [PATCH 1/8] dmaengine: ptdma: " Wolfram Sang
2026-10-10 12:57 ` sashiko-bot
2026-10-12 14:51 ` Frank Li
2026-10-10 12:43 ` [PATCH 2/8] dmaengine: fsl_raid: " Wolfram Sang
2026-10-10 12:43 ` [PATCH 3/8] dmaengine: idxd: " Wolfram Sang
2026-10-13 22:54 ` Vinicius Costa Gomes
2026-10-10 12:43 ` [PATCH 4/8] dmaengine: ioat: " Wolfram Sang
2026-10-10 12:43 ` [PATCH 5/8] dmaengine: mv_xor_v2: " Wolfram Sang
2026-10-10 12:54 ` sashiko-bot [this message]
2026-10-10 12:43 ` [PATCH 6/8] dmaengine: plx_dma: " Wolfram Sang
2026-10-10 12:56 ` sashiko-bot
2026-10-13 20:06 ` Logan Gunthorpe
2026-10-10 12:43 ` [PATCH 7/8] dmaengine: switchtec-dma: " Wolfram Sang
2026-10-10 12:54 ` sashiko-bot
2026-10-13 20:06 ` Logan Gunthorpe
2026-10-10 12:43 ` [PATCH 8/8] dmaengine: xgene-dma: " Wolfram Sang
2026-10-12 10:42 ` [PATCH 0/8] dmaengine: " Wolfram Sang
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=sashiko-outbox-166552@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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.