From: sashiko-bot@kernel.org
To: "Peter LaDow" <pladow@gmail.com>
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v5 1/4] leds: rgb: lp5860: Fix off-by-one bounds checks for LED channels
Date: Fri, 04 Dec 2026 14:53:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-250026@kernel.org> (raw)
In-Reply-To: <20261204-add-i2c-support-for-lp5860-v5-1-4cba58fe3c5b@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] leds: lp5860: use-after-put of led_node in
lp5860_iterate_subleds()
--
commit 696d051ec392f261597165c340e7a4ddf246af4e
Author: Peter LaDow <pladow@gmail.com>
leds: rgb: lp5860: Fix off-by-one bounds checks for LED channels
This commit fixes off-by-one bounds checks for LP5860 dot indices and LED
channel numbers, and separates the out-of-range channel check in
lp5860_iterate_subleds() so it returns -EINVAL.
> diff --git a/drivers/leds/rgb/leds-lp5860-core.c b/drivers/leds/rgb/leds-lp5860-core.c
> index e21d5f2302be0..0ad99d11dfdf2 100644
> --- a/drivers/leds/rgb/leds-lp5860-core.c
> +++ b/drivers/leds/rgb/leds-lp5860-core.c
[ ... ]
> @@ -114,11 +114,18 @@ static int lp5860_iterate_subleds(struct lp5860_led *led, struct led_init_data *
> }
>
> ret = fwnode_property_read_u32(led_node, "reg", &channel);
> - if (ret < 0 || channel > LP5860_MAX_LED) {
> - dev_err_probe(led->chip->dev, ret,
> - "%pfwP: 'reg' property is missing. Skipping.\n", led_node);
> + if (ret < 0) {
> fwnode_handle_put(led_node);
> - return ret;
> + return dev_err_probe(led->chip->dev, ret,
> + "%pfwP: 'reg' property is missing. Skipping.\n",
> + led_node);
> + }
> +
> + if (channel >= LP5860_MAX_LED) {
> + fwnode_handle_put(led_node);
> + return dev_err_probe(led->chip->dev, -EINVAL,
> + "%pfwP: invalid 'reg' channel %u\n",
> + led_node, channel);
> }
[Severity: Medium]
Can both error paths pass a freed led_node to dev_err_probe()?
fwnode_handle_put(led_node) drops the loop reference before dev_err_probe()
formats %pfwP, which dereferences led_node via fwnode_get_name(). If
led_node is dynamically refcounted (such as under CONFIG_OF_DYNAMIC or
software nodes), freeing it before formatting causes a use-after-free.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-add-i2c-support-for-lp5860-v5-0-4cba58fe3c5b@gmail.com?part=1
next prev parent reply other threads:[~2026-12-04 14:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:40 [PATCH v5 0/4] leds: rgb: lp5860: Add I2C support Peter LaDow via B4 Relay
2026-12-04 14:40 ` [PATCH v5 1/4] leds: rgb: lp5860: Fix off-by-one bounds checks for LED channels Peter LaDow via B4 Relay
2026-12-04 14:53 ` sashiko-bot [this message]
2026-12-04 14:40 ` [PATCH v5 2/4] dt-bindings: leds: ti,lp5860: Document I2C interface Peter LaDow via B4 Relay
2026-12-04 15:03 ` sashiko-bot
2026-12-04 14:40 ` [PATCH v5 3/4] leds: rgb: lp5860: Consolidate common probe setup in lp5860_device_init() Peter LaDow via B4 Relay
2026-12-04 14:40 ` [PATCH v5 4/4] leds: rgb: lp5860: Add I2C interface support Peter LaDow via B4 Relay
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=sashiko-outbox-250026@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pladow@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