Re: [PATCH v8 3/7] leds: rgb: leds-ktd202x: Initialize mutex earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 3, 2024 at 12:14 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> The mutex must be initialized before the LED class device is registered
> otherwise there is a race where it may get used before it is initialized:
>
>  DEBUG_LOCKS_WARN_ON(lock->magic != lock)
>  WARNING: CPU: 2 PID: 2045 at kernel/locking/mutex.c:587 __mutex_lock
>  ...
>  RIP: 0010:__mutex_lock+0x7db/0xc10
>  ...
>  set_brightness_delayed_set_brightness.part.0+0x17/0x60
>  set_brightness_delayed+0xf1/0x100
>  process_one_work+0x222/0x5a0

...

> +       mutex_init(&chip->mutex);

devm_mutex_init() ?

...

There is an immutable branch (in case of this series going behind LED
subsystem):
https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git/log/?h=ib-leds-locking-6.10


-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux