Re: (subset) [PATCH v4] leds: tca6507: Fix use-after-free on unbind

From: Lee Jones

Date: Tue Nov 17 2026 - 08:09:41 EST


On Wed, 04 Nov 2026 13:30:38 -0600, Danish Khateeb wrote:
> Since the LEDs are registered with devm_led_classdev_register(), they
> are unregistered only after tca6507_remove() has cancelled the work.
> Unregistering an LED that is on turns it off, which queues the work
> again from led_assign(), and the work then runs after devres has freed
> the chip:
>
> BUG: KASAN: slab-use-after-free in assign_work+0x414/0x5b0
> Read of size 8 at addr ffff888010d5c0c0 by task kworker/1:2/65
> ...
> Last potentially related work creation:
> ...
> queue_work_on+0xb6/0xc0
> led_assign+0x223/0x340 [leds_tca6507]
> led_classdev_unregister+0x26b/0x340
> release_nodes+0xb3/0x140
> devres_release_group+0x247/0x470
> i2c_device_remove+0xbf/0x1b0
>
> [...]

Applied, thanks!

[1/1] leds: tca6507: Fix use-after-free on unbind
commit: c92d6666ffaca04015e91df3b1789c15c965e3d2

--
Lee Jones [李琼斯]