Re: [PATCH v3 2/2] cap11xx: add LED support

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

 



On 06/15/2015 10:56 AM, Matt Ranostay wrote:
> On Mon, Jun 15, 2015 at 1:15 AM, Jacek Anaszewski
> <j.anaszewski@xxxxxxxxxxx> wrote:

>>> +               error = devm_led_classdev_register(dev, &led->cdev);
>>> +               if (error < 0)
>>> +                       return -EINVAL;
>>> +               INIT_WORK(&led->work, cap11xx_led_work);
>>> +               schedule_work(&led->work);
>>
>>
>> Work queue should be initialized before registration of the LED class
>> device.
> What is the reason for this? Just curious

It's a race condition. The LED device is accessible once
devm_led_classdev_register() returns. So a user could be calling into
cap11xx_led_set() before the work queue is initialized, which would
hence access a NULL pointer.


Daniel

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux