From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <pengpeng@iscas.ac.cn>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH] remoteproc: imx_dsp: acquire runtime PM before adding carveouts
Date: Sun, 30 Aug 2026 13:43:47 +0000 [thread overview]
Message-ID: <20260830134348.140621F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260830133310.6926-1-pengpeng@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] If `imx_dsp_rproc_add_carveout()` fails during its iteration, or if later stages like firmware parsing fail after a successful prepare, previously added carveouts and coredump segments are permanently leaked on the remoteproc lists.
- [High] Mailbox channels allocated during runtime resume are leaked if clock enable fails in `imx_dsp_runtime_resume()`.
--
commit 1aa0eaf53776f4fb1deb0e079f298b5ed6746813
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>
remoteproc: imx_dsp: acquire runtime PM before adding carveouts
This commit fixes the prepare callback by acquiring the runtime-PM
reference before publishing DSP carveouts. This ensures that if the PM
resume fails, the transaction is not partially published.
> diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c
> index fd60c67ba8a9f..96d619daf3f5b 100644
> --- a/drivers/remoteproc/imx_dsp_rproc.c
> +++ b/drivers/remoteproc/imx_dsp_rproc.c
> @@ -726,14 +726,17 @@ static int imx_dsp_rproc_prepare(struct rproc *rproc)
> struct device *dev = rproc->dev.parent;
> int ret;
>
> + ret = pm_runtime_resume_and_get(dev);
[Severity: High]
This isn't a bug introduced by this patch, but looking at what happens during
this runtime resume, if clk_bulk_prepare_enable() fails in
imx_dsp_runtime_resume(), it returns directly:
drivers/remoteproc/imx_dsp_rproc.c:imx_dsp_runtime_resume() {
...
ret = clk_bulk_prepare_enable(DSP_RPROC_CLK_MAX, priv->clks);
if (ret) {
dev_err(dev, "failed on clk_bulk_prepare_enable\n");
return ret;
}
...
}
Does this bypass imx_dsp_rproc_free_mbox() and permanently leak the exclusive
mailbox channels allocated just above it via imx_dsp_rproc_mbox_init()?
Subsequent runtime resume attempts might fail with -EBUSY when
mbox_request_channel_byname() is called again for the same channels, breaking
device functionality.
> + if (ret < 0)
> + return ret;
> +
> ret = imx_dsp_rproc_add_carveout(priv);
> if (ret) {
> dev_err(dev, "failed on imx_dsp_rproc_add_carveout\n");
> + pm_runtime_put_sync(dev);
> return ret;
[Severity: High]
This is a pre-existing issue, but if imx_dsp_rproc_add_carveout() fails
midway through its loop (e.g., returning -ENOMEM or -EINVAL), it returns an
error without freeing earlier allocations.
Furthermore, if this prepare callback fully succeeds but rproc_parse_fw()
subsequently fails in the remoteproc core, the core jumps to the
unprepare_rproc label (which calls imx_dsp_rproc_unprepare) and completely
bypasses rproc_resource_cleanup().
Does this permanently leak the previously added rproc_mem_entry and
rproc_dump_segment objects on the remoteproc lists?
Repeated boot failures could continually append memory to these lists,
eventually causing an out-of-memory condition.
> }
>
> - pm_runtime_get_sync(dev);
> -
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260830133310.6926-1-pengpeng@iscas.ac.cn?part=1
next prev parent reply other threads:[~2026-08-30 13:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 13:33 [PATCH] remoteproc: imx_dsp: acquire runtime PM before adding carveouts Pengpeng Hou
2026-08-30 13:43 ` sashiko-bot [this message]
2026-09-02 16:50 ` Mathieu Poirier
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=20260830134348.140621F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=pengpeng@iscas.ac.cn \
--cc=sashiko-reviews@lists.linux.dev \
/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.