From: sashiko-bot@kernel.org
To: "Ernest Van Hoecke" <ernestvanhoecke@gmail.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC 1/2] of: property: fw_devlink: Follow GPIO nexus maps
Date: Wed, 02 Sep 2026 11:50:39 +0000 [thread overview]
Message-ID: <20260902115040.5616A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902-fw-devlink-nexus-ready-v1-1-68fe1996e78a@toradex.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Medium] Infinite loop in `of_parse_phandle_with_args_map` due to lack of cycle detection when parsing `*-map` properties.
--
commit 97ac59dad65377a6557c6606a4f1c695b9fd0847
Author: Ernest Van Hoecke <ernest.vanhoecke@toradex.com>
of: property: fw_devlink: Follow GPIO nexus maps
This commit updates fw_devlink to parse GPIO properties using the map-aware
parser of_parse_phandle_with_args_map() instead of treating them as direct
phandle references. This ensures fw_devlink identifies the correct GPIO
provider rather than a translation nexus, and adds corresponding unittest
coverage.
Link: https://lore.kernel.org/all/juuc4af7ndbajcl7gzf4tg5qz2q2j5tt3rvql4jbauradujrre@gc5nbdhhixaf/
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 72cf12907de03..380df0861ab97 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
[ ... ]
> @@ -1311,6 +1311,19 @@ static struct device_node *parse_prop_cells(struct device_node *np,
> return sup_args.np;
> }
>
> +static struct device_node *parse_nexus_prop(struct device_node *np,
> + const char *prop_name, int index,
> + const char *stem_name)
> +{
> + struct of_phandle_args sup_args;
> +
> + if (of_parse_phandle_with_args_map(np, prop_name, stem_name, index,
> + &sup_args))
[Severity: Medium]
This is a pre-existing issue, but does of_parse_phandle_with_args_map() lack
cycle detection when parsing *-map properties?
Looking at of_parse_phandle_with_args_map() in drivers/of/base.c, the loop
that follows mapping indirection lacks a cycle breaker:
drivers/of/base.c:of_parse_phandle_with_args_map() {
...
while (cur) {
/* Get the <list>-map property */
map = of_get_property(cur, map_name, &map_len);
...
out_args->np = new;
of_node_put(cur);
cur = new;
new = NULL;
}
...
}
If a cyclic device tree overlay introduces a cycle in the *-map properties,
could this while (cur) loop indefinitely follow the mapping indirection
and cause a denial of service? The function seems to jump directly to
reassigning cur = new and restarting the traversal without any cycle-breaking
or visited-node verification.
> + return NULL;
> +
> + return sup_args.np;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902-fw-devlink-nexus-ready-v1-0-68fe1996e78a@toradex.com?part=1
next prev parent reply other threads:[~2026-09-02 11:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 11:41 [PATCH RFC 0/2] of: property: Make fw_devlink follow GPIO and PWM nexus maps Ernest Van Hoecke
2026-09-02 11:41 ` [PATCH RFC 1/2] of: property: fw_devlink: Follow GPIO " Ernest Van Hoecke
2026-09-02 11:50 ` sashiko-bot [this message]
2026-09-02 12:30 ` Bartosz Golaszewski
2026-09-02 13:22 ` Ernest Van Hoecke
2026-09-02 16:55 ` Herve Codina
2026-09-03 9:57 ` Miquel Raynal
2026-09-03 11:51 ` Ernest Van Hoecke
2026-09-03 11:48 ` Ernest Van Hoecke
2026-09-03 9:18 ` Bartosz Golaszewski
2026-09-02 11:41 ` [PATCH RFC 2/2] of: property: fw_devlink: Follow PWM " Ernest Van Hoecke
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=20260902115040.5616A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ernestvanhoecke@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