From: sashiko-bot@kernel.org
To: "David Heidelberg" <david@ixit.cz>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 2/2] arm64: dts: qcom: sdm845-google: Enable PMI8998 camera flash LEDs
Date: Sun, 19 Jul 2026 18:12:21 +0000 [thread overview]
Message-ID: <20260719181222.4F9831F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260719-pixel3-camera-v5-2-99593f1bd8ec@ixit.cz>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] A preexisting logical error in the teardown and error paths of `leds-qcom-flash.c` reads out-of-bounds of the `v4l2_flash` array, causing it to either leak successfully initialized V4L2 flash devices or trigger a kernel panic.
--
--- Patch [2]: [PATCH v5 2/2] arm64: dts: qcom: sdm845-google: Enable PMI8998 camera flash LEDs ---
commit 93ed1a73fa53c221bf41460abbfe7fe7c99737a0
Author: David Heidelberg <david@ixit.cz>
arm64: dts: qcom: sdm845-google: Enable PMI8998 camera flash LEDs
Enable the PMI8998 flash LED block and describe two white flash LEDs
used for the rear camera.
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi
> --- a/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi
[ ... ]
> +&pmi8998_flash {
> + status = "okay";
> +
> + /* upper part */
> + led-0 {
> + function = LED_FUNCTION_FLASH;
> + color = <LED_COLOR_ID_WHITE>;
> + led-sources = <1>;
> + led-max-microamp = <500000>;
> + flash-max-microamp = <1500000>;
> + flash-max-timeout-us = <1280000>;
> + function-enumerator = <0>;
> + };
> +
> + /* bottom part */
> + led-1 {
> + function = LED_FUNCTION_FLASH;
> + color = <LED_COLOR_ID_WHITE>;
> + led-sources = <2>;
> + led-max-microamp = <500000>;
> + flash-max-microamp = <1500000>;
> + flash-max-timeout-us = <1280000>;
> + function-enumerator = <1>;
> + };
> +};
[Severity: High]
This is a pre-existing issue, but configuring multiple flash LEDs exposes an
out-of-bounds array access in the leds-qcom-flash driver.
During driver teardown in qcom_flash_led_remove(), the code attempts to
access the v4l2_flash array at index leds_count:
drivers/leds/flash/leds-qcom-flash.c:qcom_flash_led_remove() {
...
while (flash_data->v4l2_flash[flash_data->leds_count] &&
flash_data->leds_count)
v4l2_flash_release(flash_data->v4l2_flash[flash_data->leds_count--]);
...
}
If the probe is successful, leds_count equals the number of LEDs. Accessing
the array at that index reads past the end of the dynamically allocated
structure, potentially causing a panic or leaking resources if the
out-of-bounds memory happens to be NULL.
The probe error path in qcom_flash_led_probe() shares this logic. If probing
fails on the second LED, v4l2_flash at that index is NULL. The loop
evaluates to false immediately and terminates without freeing the
successfully initialized first LED.
Could we fix the array bounds check and release logic in the driver before
exposing it via this multi-LED device tree configuration?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260719-pixel3-camera-v5-0-99593f1bd8ec@ixit.cz?part=2
next prev parent reply other threads:[~2026-07-19 18:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 18:03 [PATCH v5 0/2] Add initial dual front camera and rear flash support for Pixel 3 / 3 XL David Heidelberg via B4 Relay
2026-07-19 18:03 ` [PATCH v5 1/2] arm64: dts: qcom: sdm845-google: Add dual front IMX355 cameras David Heidelberg via B4 Relay
2026-07-19 18:24 ` sashiko-bot
2026-07-19 18:57 ` David Heidelberg
2026-07-20 8:24 ` Konrad Dybcio
2026-07-20 10:49 ` David Heidelberg
2026-07-19 18:03 ` [PATCH v5 2/2] arm64: dts: qcom: sdm845-google: Enable PMI8998 camera flash LEDs David Heidelberg via B4 Relay
2026-07-19 18:12 ` sashiko-bot [this message]
2026-07-20 8:26 ` Konrad Dybcio
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=20260719181222.4F9831F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--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