From: sashiko-bot@kernel.org
To: "Manuel Fombuena" <fombuena@outlook.com>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v7 8/9] leds: st1202: validate LED reg property against channel count
Date: Thu, 02 Jul 2026 22:49:23 +0000 [thread overview]
Message-ID: <20260702224923.A83671F000E9@smtp.kernel.org> (raw)
In-Reply-To: <GV1PR08MB849718B43321DB7E5A05D17BC5F52@GV1PR08MB8497.eurprd08.prod.outlook.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver assigns a sleepable function to the LED subsystem's non-blocking `brightness_set` callback, leading to "scheduling while atomic" kernel panics.
--
Note: The format of this review is altered to use a free-form summary instead
of inline diff quotes due to recitation restrictions.
commit e35dcdba8764dc455863a8cb25600d5218b1d1a5
Author: Manuel Fombuena <fombuena@outlook.com>
leds: st1202: validate LED reg property against channel count
The reg property from the device tree is used directly as an array index
into chip->leds[] without bounds checking. A value >= ST1202_MAX_LEDS
would cause an out-of-bounds write during probe.
[Severity: High]
This is a pre-existing issue, but does this code cause a "scheduling while
atomic" panic when a software trigger like heartbeat or timer is configured?
In drivers/leds/leds-st1202.c during st1202_dt_init(), the driver assigns
st1202_brightness_set to led->led_cdev.brightness_set. The brightness_set
callback is expected to be non-blocking by the LED subsystem core.
However, st1202_brightness_set() uses guard(mutex)(&chip->lock) and performs
I2C transactions, both of which are blocking operations.
When a software trigger fires in a softirq timer context, it calls
led_set_brightness_nosleep(), which directly invokes the brightness_set
callback. Since the callback attempts to acquire a mutex and perform I2C
transfers from this atomic context, it causes a kernel panic.
--
Sashiko AI review · https://sashiko.dev/#/patchset/GV1PR08MB8497C0B898789BB73ACE6EE3C5F52@GV1PR08MB8497.eurprd08.prod.outlook.com?part=8
next prev parent reply other threads:[~2026-07-02 22:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 22:23 [PATCH v7 0/9] leds: st1202: fix multiple bugs in pattern engine and brightness handling Manuel Fombuena
2026-07-02 22:27 ` [PATCH v7 1/9] leds: st1202: stop pattern sequence before reprogramming Manuel Fombuena
2026-07-02 22:48 ` sashiko-bot
2026-07-03 10:51 ` Manuel Fombuena
2026-07-02 22:28 ` [PATCH v7 2/9] leds: st1202: validate pattern input before stopping the sequence Manuel Fombuena
2026-07-02 22:50 ` sashiko-bot
2026-07-03 10:53 ` Manuel Fombuena
2026-07-02 22:29 ` [PATCH v7 3/9] leds: st1202: fix pattern duration prescaler and pattern_clear skip marker Manuel Fombuena
2026-07-02 22:50 ` sashiko-bot
2026-07-03 10:54 ` Manuel Fombuena
2026-07-02 22:30 ` [PATCH v7 4/9] leds: st1202: set all pattern PWM slots to full after clearing pattern Manuel Fombuena
2026-07-02 22:48 ` sashiko-bot
2026-07-03 10:56 ` Manuel Fombuena
2026-07-02 22:31 ` [PATCH v7 5/9] leds: st1202: fix spurious pattern sequence start in setup Manuel Fombuena
2026-07-02 22:50 ` sashiko-bot
2026-07-03 10:57 ` Manuel Fombuena
2026-07-02 22:33 ` [PATCH v7 6/9] leds: st1202: fix brightness having no effect while pattern mode is active Manuel Fombuena
2026-07-02 22:49 ` sashiko-bot
2026-07-03 10:59 ` Manuel Fombuena
2026-07-02 22:34 ` [PATCH v7 7/9] leds: st1202: disable channel when brightness is set to zero Manuel Fombuena
2026-07-02 22:47 ` sashiko-bot
2026-07-03 11:00 ` Manuel Fombuena
2026-07-02 22:35 ` [PATCH v7 8/9] leds: st1202: validate LED reg property against channel count Manuel Fombuena
2026-07-02 22:49 ` sashiko-bot [this message]
2026-07-03 11:01 ` Manuel Fombuena
2026-07-02 22:37 ` [PATCH v7 9/9] leds: st1202: correct and extend hw_pattern documentation Manuel Fombuena
2026-07-02 22:58 ` sashiko-bot
2026-07-03 11:02 ` Manuel Fombuena
2026-07-03 11:21 ` [PATCH v7 0/9] leds: st1202: fix multiple bugs in pattern engine and brightness handling Manuel Fombuena
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=20260702224923.A83671F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fombuena@outlook.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.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