From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCHv3 8/8] dmaengine: ti: omap-dma: turn lch_map into a flexible array
Date: Wed, 03 Jun 2026 03:23:59 +0000 [thread overview]
Message-ID: <20260603032400.595881F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603030754.288757-9-rosenp@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free due to dangling CPU PM notifier on probe failure or device unbind
--
Note: The format of this review has been altered due to recitation restrictions.
No code from the patch is directly quoted below.
commit 8df6bfe3cea1126b3e862e90d788d6cedc19c9bf
Author: Rosen Penev <rosenp@gmail.com>
dmaengine: ti: omap-dma: turn lch_map into a flexible array
This commit converts the lch_map pointer array to a C99 flexible array member
at the end of struct omap_dmadev. The probe function is reordered to look up
platform data and determine the logical channel count before allocation,
collapsing two allocations into one and enabling bounds checking.
[Severity: High]
This isn't a bug introduced by this patch, but there is a pre-existing
issue with CPU PM notifier registration in omap_dma_probe() and cleanup
in omap_dma_remove().
In omap_dma_probe(), if of_dma_controller_register() fails, the code cleans
up some resources, but it doesn't return early. Instead, execution drops
through to the end of the function, where it registers the CPU PM notifier
by calling cpu_pm_register_notifier(&od->nb) before finally returning the
error code. Since the probe failed, the memory for the device structure will
be freed, but the notifier remains in the global chain.
Additionally, in omap_dma_remove(), cpu_pm_unregister_notifier() is only
called if od->cfg->may_lose_context is true. However, in omap_dma_probe(),
the notifier is registered if either needs_busy_check or may_lose_context
is true. If a platform has needs_busy_check set but may_lose_context false,
the notifier is never unregistered during device removal.
Could these paths leave a dangling pointer in the CPU PM notifier chain,
resulting in a use-after-free when a subsequent power management event
triggers the callback?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603030754.288757-9-rosenp@gmail.com?part=1
prev parent reply other threads:[~2026-06-03 3:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 3:07 [PATCH v3 0/8] dmaengine: ti: omap-dma: probe/remove bug fixes and cleanup Rosen Penev
2026-06-03 3:07 ` [PATCHv3 1/8] dmaengine: ti: omap-dma: fix missing return in probe error path Rosen Penev
2026-06-03 3:18 ` sashiko-bot
2026-06-03 3:07 ` [PATCHv3 2/8] dmaengine: ti: omap-dma: synchronize CPU PM notifier removal Rosen Penev
2026-06-03 3:18 ` sashiko-bot
2026-06-03 3:07 ` [PATCHv3 3/8] dmaengine: ti: omap-dma: fix CPU PM notifier leak Rosen Penev
2026-06-03 3:07 ` [PATCHv3 4/8] dmaengine: ti: omap-dma: stop channels during teardown Rosen Penev
2026-06-03 3:25 ` sashiko-bot
2026-06-03 3:07 ` [PATCHv3 5/8] dmaengine: ti: omap-dma: disable IRQs on probe failure Rosen Penev
2026-06-03 3:21 ` sashiko-bot
2026-06-03 3:07 ` [PATCHv3 6/8] dmaengine: ti: omap-dma: destroy descriptor pool last Rosen Penev
2026-06-03 3:07 ` [PATCHv3 7/8] dmaengine: ti: omap-dma: fix interrupt handling in remove Rosen Penev
2026-06-03 3:07 ` [PATCHv3 8/8] dmaengine: ti: omap-dma: turn lch_map into a flexible array Rosen Penev
2026-06-03 3:23 ` sashiko-bot [this message]
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=20260603032400.595881F00893@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