mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] leds: tca6507: Fix use-after-free on unbind and turn the LEDs off
@ 2026-10-28 17:43 Danish Khateeb
  2026-10-28 17:43 ` [PATCH v3 1/2] leds: tca6507: Fix use-after-free on unbind Danish Khateeb
  2026-10-28 17:43 ` [PATCH v3 2/2] leds: tca6507: Turn the LEDs off " Danish Khateeb
  0 siblings, 2 replies; 3+ messages in thread
From: Danish Khateeb @ 2026-10-28 17:43 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: Andrew Davis, linux-leds, linux-kernel, Danish Khateeb

Patch 1 is v2 unchanged apart from the rebase. It sets the work up with
devm_work_autocancel() so devres cancels it after the LEDs are gone.

Sashiko pointed out that the "LED off" write queued by unregistering the
LEDs then gets cancelled, so an LED that was on may stay on after unbind.
That was already the case before 1b5c2fa7081c. Patch 2 fixes it by
flushing the work instead of cancelling it. It is not marked for stable.

Changes in v3:
- Add patch 2 (Lee)
- Rebase on for-leds-next
- Link to v2: https://lore.kernel.org/all/20261015144033.56519-1-danishkhateeb03@gmail.com/

Tested in QEMU on a next-20260930 KASAN kernel, with the driver built as
a module and a test-only module that adds a fake I2C adapter, logs the
register writes and adds a software node for a TCA6507 with two LEDs.
With both LEDs on, each of 20 unbinds was checked for a final write
clearing both LEDs: with patch 1 alone it was missing in 7 of 20, with
patch 2 in none. There were no KASAN reports with either, over 20
bind/unbind cycles and an unload. A W=1 build with GPIOLIB is clean.

An LLM was used to help with this series.

Danish Khateeb (2):
  leds: tca6507: Fix use-after-free on unbind
  leds: tca6507: Turn the LEDs off on unbind

 drivers/leds/leds-tca6507.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)


base-commit: 59cf91cf87abb67a49b1bb7b9d3b06486abde8cf
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-28 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 17:43 [PATCH v3 0/2] leds: tca6507: Fix use-after-free on unbind and turn the LEDs off Danish Khateeb
2026-10-28 17:43 ` [PATCH v3 1/2] leds: tca6507: Fix use-after-free on unbind Danish Khateeb
2026-10-28 17:43 ` [PATCH v3 2/2] leds: tca6507: Turn the LEDs off " Danish Khateeb

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®