mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Cong Nguyen <congnt264@gmail.com>
Cc: Pavel Machek <pavel@kernel.org>,
	Fenglin Wu <quic_fenglinw@quicinc.com>,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] leds: flash: qcom-flash: fix the v4l2 flash release loops
Date: Wed, 2 Dec 2026 14:04:23 +0000	[thread overview]
Message-ID: <20261202140423.GC43081@kernel.org> (raw)
In-Reply-To: <20261124095408.3842986-1-congnt264@gmail.com>

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@gmail.com>

Set does not apply - please rebase onto -next and submit a [RESEND].

-- 
Lee Jones

      parent reply	other threads:[~2026-12-02 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  9:54 Cong Nguyen
2026-11-24  9:54 ` [PATCH 2/2] leds: flash: qcom-flash: release v4l2 flash devices on torch clamp failure Cong Nguyen
2026-12-02 14:04 ` Lee Jones [this message]

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=20261202140423.GC43081@kernel.org \
    --to=lee@kernel.org \
    --cc=congnt264@gmail.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=quic_fenglinw@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®