Re: [PATCH 1/2] leds: flash: qcom-flash: fix the v4l2 flash release loops
From: Nguyễn Công
Date: Wed Dec 02 2026 - 12:57:47 EST
On Wed, Dec 2, 2026 at 9:04 PM Lee Jones <lee@xxxxxxxxxx> wrote:
>
> On Tue, 24 Nov 2026, Cong Nguyen wrote:
>
> > qcom_flash_v4l2_init() stores each LED's v4l2_flash in
> > v4l2_flash[leds_count], and probe increments leds_count after each LED.
> > So the valid entries are 0..leds_count - 1.
> >
> > The release loops in the probe error path and in remove() start one past
> > the last stored entry and never reach index 0:
> >
> > while (v4l2_flash[leds_count] && leds_count)
> > v4l2_flash_release(v4l2_flash[leds_count--]);
> >
> > After a successful probe of N LEDs, remove() reads index N of an array
> > with N entries. When probe fails, that entry is NULL, so nothing is
> > released.
> >
> > Release the entries from leds_count - 1 down to 0 instead.
> > v4l2_flash_release() ignores NULL.
> >
> > This issue was found by auditing the driver with an LLM coding assistant.
> >
> > Fixes: 96a2e242a5dc ("leds: flash: Add driver to support flash LED module in QCOM PMICs")
> > Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
>
> Set does not apply - please rebase onto -next and submit a [RESEND].
Hi Lee, thanks. Both patches are already fixed in for-leds-next by
75565a889829 ("leds: flash:
leds-qcom-flash: Release all V4L2 flash devices"), so please drop the
series. Sorry for the noise.
>
> --
> Lee Jones