All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Carlo Szelinsky" <github@szelinsky.de>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH 1/3] leds: class: Fix the LED name in the debug message after registering
Date: Sat, 28 Nov 2026 21:56:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-239056@kernel.org> (raw)
In-Reply-To: <20261128215230.66205-2-github@szelinsky.de>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] leds: uninitialized rwsem race in led_trigger_read() [1]
--

commit 49db16c343f5b4c3b48a74345ac2e46cd2c2cac1
Author: Carlo Szelinsky <github@szelinsky.de>

leds: class: Fix the LED name in the debug message after registering

This commit updates the registration debug message in
led_classdev_register_ext() to print dev_name(led_cdev->dev) instead of
led_cdev->name, which is unset when init_data is used.

> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 00be3cb96c00f..23d692035150f 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -586,7 +586,7 @@ int led_classdev_register_ext(struct device *parent,
>  	mutex_unlock(&led_cdev->led_access);

[Severity: Critical]
This problem wasn't introduced by this patch, but can led_trigger_read()
call down_read() on led_cdev->trigger_lock before it is initialized [1]?

In led_classdev_register_ext(), device_create_with_groups() exposes the
trigger sysfs attribute before init_rwsem(&led_cdev->trigger_lock) runs.
Unlike other sysfs callbacks, led_trigger_read() does not acquire
led_cdev->led_access:

CPU0                                  CPU1
led_classdev_register_ext()
  mutex_lock(&led_cdev->led_access)
  device_create_with_groups(...)
                                      led_trigger_read()
                                        down_read(&led_cdev->trigger_lock)
                                          <-- uninitialized rw_semaphore
  init_rwsem(&led_cdev->trigger_lock)

A concurrent read of the trigger sysfs file during registration operates on
an uninitialized rw_semaphore, corrupting lock state and crashing the
kernel.

[1] https://sashiko.dev/#/bug/linux-376c7db5-ddc1-4faa-9f5b-43d2d3b7cb0d

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128215230.66205-1-github@szelinsky.de?part=1

  reply	other threads:[~2026-11-28 21:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 21:52 [PATCH 0/3] leds: Fix "(null)" LED names after registering Carlo Szelinsky
2026-11-28 21:52 ` [PATCH 1/3] leds: class: Fix the LED name in the debug message " Carlo Szelinsky
2026-11-28 21:56   ` sashiko-bot [this message]
2026-11-28 21:52 ` [PATCH 2/3] leds: syscon: Remove the probe message Carlo Szelinsky
2026-11-28 21:52 ` [PATCH 3/3] leds: bcm6328, bcm6358: Remove the registration debug message Carlo Szelinsky
2026-11-28 21:56 ` [PATCH 0/3] leds: Fix "(null)" LED names after registering sashiko-bot

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-239056@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=github@szelinsky.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.