Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH AUTOSEL 6.18-5.10] leds: pca9532: Don't stop blinking for non-zero brightness
Date: Mon, 31 Aug 2026 14:58:18 +0000	[thread overview]
Message-ID: <20260831145819.6F6481F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831133314.4125787-192-sashal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Race condition in N2100_BEEP input device teardown leading to use-after-free
--

commit 7c75890ff5fc7d7cfe4c161d927be50be43a1827
Author: Tobias Deiminger <tobias.deiminger@linutronix.de>

leds: pca9532: Don't stop blinking for non-zero brightness

This patch prevents the pca9532 driver from incorrectly stopping hardware
blinking when a non-zero brightness value is set. It adds a guard to return 
early if the LED state is PCA9532_PWM1, aligning the behavior with the 
LED subsystem documentation.

Link: https://patch.msgid.link/20260331202848.658676-1-tobias.deiminger@linutronix.de

> diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
> index 0344189bb991c..dae7c67605084 100644
> --- a/drivers/leds/leds-pca9532.c
> +++ b/drivers/leds/leds-pca9532.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but while looking at this driver,
I noticed a potential use-after-free race during teardown of the N2100_BEEP
input device.

In pca9532_destroy_devices(), the worker is canceled but the managed input
device remains active until devres unwinds:

    case PCA9532_TYPE_N2100_BEEP:
        if (data->idev != NULL) {
            cancel_work_sync(&data->work);
            data->idev = NULL;
        }
        break;

If an input event (e.g., SND_BELL) arrives through the evdev node in this
narrow window before devres unwinds, pca9532_event() will blindly queue
up the work again:

    schedule_work(&data->work);

Once devres unwinding completes, the data structure is freed, but the
newly queued work remains active. When pca9532_input_work() executes, it
could access the freed data:

    static void pca9532_input_work(struct work_struct *work)
    {
        ...
        mutex_lock(&data->update_lock);

Could this result in a use-after-free crash if a user space process writes
to the input event node during driver removal? Should the input device be
explicitly unregistered before canceling the work?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-192-sashal@kernel.org?part=1

  reply	other threads:[~2026-08-31 14:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18] leds: core: Fix race condition for software blink Sasha Levin
2026-08-31 14:50   ` sashiko-bot
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-5.10] leds: pca9532: Don't stop blinking for non-zero brightness Sasha Levin
2026-08-31 14:58   ` sashiko-bot [this message]
2026-08-31 13:26 ` [PATCH AUTOSEL 6.18-6.12] leds: trigger: gpio: Use GPIOD_FLAGS_BIT_NONEXCLUSIVE Sasha Levin
2026-08-31 15:49   ` sashiko-bot
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18-5.10] leds: uleds: Return -EFAULT on copy_to_user() failure Sasha Levin
2026-08-31 17:13   ` sashiko-bot
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] leds: tps6131x: Increase overvoltage protection threshold to 6V Sasha Levin
2026-08-31 17:13   ` 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=20260831145819.6F6481F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=sashal@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