From: sashiko-bot@kernel.org
To: "Vinayak Katoch" <vinayak.katoch@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 1/3] misc: fastrpc: iterate CB nodes manually instead of of_platform_populate
Date: Wed, 23 Sep 2026 08:50:35 +0000 [thread overview]
Message-ID: <20260923085036.1F7801F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923-dup-sessions-v5-1-e953133a1827@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] of: double-free of device_node references in OF iterator loops
- [Medium] driver-core: memory leak of platform_device in fastrpc_cb_devices_destroy
--
commit 0cd61e434e0b0defac9c431333bfa40bb39df800
Author: Vinayak Katoch <vinayak.katoch@oss.qualcomm.com>
misc: fastrpc: iterate CB nodes manually instead of of_platform_populate
This commit replaces of_platform_populate() with direct iteration over child
context bank nodes to ensure synchronous initialization via fastrpc_cb_init().
It also introduces fastrpc_cb_devices_destroy() to manually clean up platform
devices during teardown and removes the standalone platform driver.
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index af18ff1992eed..f20d3e5ecc81f 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
[ ... ]
> @@ -2389,37 +2389,63 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
> -static void fastrpc_cb_remove(struct platform_device *pdev)
> +static void fastrpc_cb_devices_destroy(struct rpmsg_device *rpdev)
> {
[ ... ]
> + for_each_available_child_of_node(rdev->of_node, np) {
> + if (!of_device_is_compatible(np, "qcom,fastrpc-compute-cb")) {
> + of_node_put(np);
> + continue;
> }
[Severity: High]
Does explicitly dropping the reference before continue result in a double-free
when the loop macro advances? The for_each_available_child_of_node() iterator
inherently calls of_node_put() on the previous node when advancing. This
occurs here during device destruction in fastrpc_cb_devices_destroy().
> +
> + pdev = of_find_device_by_node(np);
> + of_node_put(np);
[Severity: High]
Does explicitly dropping the reference at the end of the loop body result in a
double-free when the loop macro advances to the next iteration?
> + if (pdev)
> + of_platform_device_destroy(&pdev->dev, NULL);
> }
[Severity: Medium]
Does this leak the platform_device reference acquired by
of_find_device_by_node() in fastrpc_cb_devices_destroy()? The reference
returned by of_find_device_by_node() has an incremented reference count, which
doesn't appear to be released via put_device() or platform_device_put() after
unregistering the device.
> - spin_unlock_irqrestore(&cctx->lock, flags);
> }
>
[ ... ]
> +static int fastrpc_cb_devices_create(struct rpmsg_device *rpdev)
> +{
> + struct device *rdev = &rpdev->dev;
> + struct platform_device *pdev;
> + struct device_node *np;
> + int err;
>
> + for_each_available_child_of_node(rdev->of_node, np) {
> + if (!of_device_is_compatible(np, "qcom,fastrpc-compute-cb")) {
> + of_node_put(np);
> + continue;
> + }
[Severity: High]
Does explicitly dropping the reference before continue result in a double-free
when the loop macro advances? The for_each_available_child_of_node() iterator
inherently calls of_node_put() on the previous node when advancing. This
occurs during driver initialization in fastrpc_cb_devices_create().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-dup-sessions-v5-0-e953133a1827@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-09-23 8:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 8:39 [PATCH v5 0/3] misc: fastrpc: fix ADSP duplicate session creation Vinayak Katoch
2026-09-23 8:39 ` [PATCH v5 1/3] misc: fastrpc: iterate CB nodes manually instead of of_platform_populate Vinayak Katoch
2026-09-23 8:50 ` sashiko-bot [this message]
2026-10-09 6:02 ` Ekansh Gupta
2026-09-23 8:39 ` [PATCH v5 2/3] misc: fastrpc: move ADSP duplicate session creation to the driver Vinayak Katoch
2026-09-23 8:50 ` sashiko-bot
2026-10-09 6:11 ` Ekansh Gupta
2026-09-23 8:39 ` [PATCH v5 3/3] dt-bindings: misc: qcom,fastrpc: deprecate qcom,nsessions Vinayak Katoch
2026-09-23 8:50 ` sashiko-bot
2026-10-09 6:12 ` Ekansh Gupta
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=20260923085036.1F7801F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vinayak.katoch@oss.qualcomm.com \
/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.