Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Laurentiu Mihalcea" <laurentiumihalcea111@gmail.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev, conor+dt@kernel.org,
	robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 2/4] remoteproc: imx_rpoc: fix carveout name parsing
Date: Thu, 30 Jul 2026 16:48:51 +0000	[thread overview]
Message-ID: <20260730164851.6C54E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730163412.1145-3-laurentiumihalcea111@gmail.com>

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

Pre-existing issues:
- [High] If `rproc_mem_entry_init()` fails, `imx_rproc_prepare()` returns an error without cleaning up carveouts and coredump segments added in previous loop iterations.
--

--- Patch [2]: [PATCH v3 2/4] remoteproc: imx_rpoc: fix carveout name parsing ---
commit 919463e3c08e2a14917d823b86fa8559b43af4fc
Author: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>

remoteproc: imx_rpoc: fix carveout name parsing

The imx remoteproc driver is updated to use the "memory-region-names" 
property for reserved memory regions instead of relying on devicetree 
node names. This allows standardizing node names according to the 
devicetree specification.

> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 7662ebd9d2f49..74719066905d6 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -672,7 +672,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
>  		int err;
>  		struct resource res;
>  
> -		err = of_reserved_mem_region_to_resource(np, i++, &res);
> +		err = imx_rproc_rmem_to_resource(np, i++, &res);
>  		if (err)
>  			break;

[Severity: High]
This isn't a bug introduced by this patch, but looking at the loop in
imx_rproc_prepare(), does the early return on rproc_mem_entry_init() failure
leak resources?

If rproc_mem_entry_init() fails, it returns -ENOMEM without cleaning up 
the carveouts and coredump segments added in previous loop iterations:

drivers/remoteproc/imx_rproc.c:imx_rproc_prepare() {
	while (1) {
		...
		mem = rproc_mem_entry_init(...);
		if (!mem)
			return -ENOMEM;
		
		rproc_coredump_add_segment(rproc, da, resource_size(&res));
		rproc_add_carveout(rproc, mem);
	}
}

This error propagates back to rproc_fw_boot(), where the error handling path
skips the clean_up_resources: label and jumps straight to disable_iommu:.

If a boot is retried by userspace (e.g., via sysfs), could this continually
append duplicate entries to the lists and eventually exhaust vmalloc space
when rproc_alloc_registered_carveouts() iterates over the duplicates and
maps the same physical memory addresses multiple times?

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

  reply	other threads:[~2026-07-30 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 16:34 [PATCH v3 0/4] Add RPROC support for the MX95-15x15-FRDM board Laurentiu Mihalcea
2026-07-30 16:34 ` [PATCH v3 1/4] dt-bindings: remoteproc: imx_rproc: document optional "memory-region-names" Laurentiu Mihalcea
2026-07-30 18:14   ` Frank Li
2026-07-31  9:37   ` Krzysztof Kozlowski
2026-07-31  9:39     ` Krzysztof Kozlowski
2026-07-31 14:34       ` Frank Li
2026-07-30 16:34 ` [PATCH v3 2/4] remoteproc: imx_rpoc: fix carveout name parsing Laurentiu Mihalcea
2026-07-30 16:48   ` sashiko-bot [this message]
2026-07-30 16:58   ` Frank Li
2026-07-31  9:38   ` Krzysztof Kozlowski
2026-07-30 16:34 ` [PATCH v3 3/4] arm64: dts: freescale: imx95-15x15-frdm: remove some rmem regions Laurentiu Mihalcea
2026-07-30 16:34 ` [PATCH v3 4/4] arm64: dts: freescale: add DT overlay for MX95-15x15-FRDM RPMSG usage Laurentiu Mihalcea

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=20260730164851.6C54E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=laurentiumihalcea111@gmail.com \
    --cc=robh@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox