dmaengine.vger.kernel.org archive mirror
 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: [PATCHv3] dmaengine: bestcomm: ioremap early
Date: Tue, 08 Sep 2026 21:40:18 +0000	[thread overview]
Message-ID: <20260908214019.368631F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260908213049.592138-1-rosenp@gmail.com>

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

Pre-existing issues:
- [High] The global pointer `bcom_eng` is freed on the probe error path but not set to `NULL`, leaving a dangling pointer that can cause a Use-After-Free.
--

commit 0501c17dd28799067260abc5f8abeeda8383de19
Author: Rosen Penev <rosenp@gmail.com>

dmaengine: bestcomm: ioremap early

This commit replaces the open-coded resource lookup, allocation, and mapping
in the mpc52xx_bcom_probe() function with
devm_platform_get_and_ioremap_resource(). It also simplifies the error
handling by removing the manual unmap and release paths.

> diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> index 432b43520ddc9..44ff4a42376b1 100644
> --- 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 does this error path leave a dangling
global pointer? 

If bcom_engine_init() fails during mpc52xx_bcom_probe(), the global
pointer bcom_eng is freed here but is not reset to NULL. Could
subsequent calls to exported functions like bcom_task_alloc() by
consumer drivers bypass their safety checks (e.g., if (!bcom_eng)) and
attempt to acquire bcom_eng->lock, resulting in a use-after-free and a
kernel crash?

>  	bcom_sram_cleanup();

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

  reply	other threads:[~2026-09-08 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 21:30 [PATCHv3] dmaengine: bestcomm: ioremap early Rosen Penev
2026-09-08 21:40 ` sashiko-bot [this message]
2026-09-09 15: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=20260908214019.368631F00A3D@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;
as well as URLs for NNTP newsgroup(s).