DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: Frank.Li@kernel.org, vkoul@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: bestcomm: ioremap early
Date: Sun, 23 Aug 2026 04:56:40 +0000	[thread overview]
Message-ID: <20260823045641.2E8B81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260823044900.11466-1-rosenp@gmail.com>

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

Pre-existing issues:
- [High] The globally exported pointer `bcom_eng` is left dangling if `mpc52xx_bcom_probe()` fails after allocating it, leading to a potential Use-After-Free.
--

--- Patch [1]: [PATCH] dmaengine: bestcomm: ioremap early ---
commit 58088fd211b9916066bb25d1ffe4afa62733063f
Author: Rosen Penev <rosenp@gmail.com>

dmaengine: bestcomm: ioremap early

This commit replaces open-coded resource lookup and mapping in the
probe function with the managed devm_platform_get_and_ioremap_resource()
helper. It also addresses a resource size mismatch between allocation
and freeing.

> diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> --- a/drivers/dma/bestcomm/bestcomm.c
> +++ b/drivers/dma/bestcomm/bestcomm.c

[ ... ]

> @@ -439,10 +422,6 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
>  	return 0;
>  
>  	/* Error path */
> -error_unmap:
> -	iounmap(bcom_eng->regs);
> -error_release:
> -	release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
>  error_sramclean:
>  	kfree(bcom_eng);

[Severity: High]
This is a pre-existing issue, but if mpc52xx_bcom_probe() fails after
allocating bcom_eng (for instance, if bcom_engine_init() fails), does this
leave the globally exported pointer bcom_eng dangling?

If it remains non-NULL after kfree(), a dependent driver like mpc52xx_fec
might later call bcom_task_alloc(), which checks if (!bcom_eng) to verify
initialization. Since the check passes, could this lead to a use-after-free
when it accesses bcom_eng->lock?

Should bcom_eng be set to NULL here, similar to how it is handled in
mpc52xx_bcom_remove()?

>  	bcom_sram_cleanup();

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260823044900.11466-1-rosenp@gmail.com?part=1

  reply	other threads:[~2026-08-23  4:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23  4:49 [PATCH] dmaengine: bestcomm: ioremap early Rosen Penev
2026-08-23  4:56 ` sashiko-bot [this message]
2026-08-23  8:00 ` Markus Elfring
2026-08-24 20:23   ` Rosen Penev
2026-08-25  7:56     ` Markus Elfring
2026-08-24 15:25 ` [PATCH] " Frank Li
2026-08-24 20:24   ` Rosen Penev
2026-08-25 14:39     ` 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=20260823045641.2E8B81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=rosenp@gmail.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