[alsa-devel] [PATCH] sound/pci/riptide or drivers/base/firmware: Fix a possible sleep-in-atomic bug

Jia-Ju Bai baijiaju1990 at 163.com
Mon Oct 9 09:55:53 CEST 2017


Thanks for your reply :)
Yes, you are right. Sorry for this false positive.


Thanks,
Jia-Ju Bai

On 2017/10/9 14:43, Takashi Iwai wrote:
> On Mon, 09 Oct 2017 04:13:16 +0200,
> Jia-Ju Bai wrote:
>> The riptide driver may sleep under a spinlock, and the function call path is:
>> snd_riptide_prepare (acquire the spinlock)
>>    setsampleformat
>>      sendcmd
>>        riptide_reset
>>          try_to_load_firmware
>>            request_firmware
>>              _request_firmware (drivers/base/firmware_class.c)
>>                _request_firmware_prepare
>>                  kzalloc(GFP_KERNEL) --> may sleep
>>
>> To fix it, GFP_KERNEL is replaced with GFP_ATOMIC in _request_firmware_prepare.
>> This bug is found by my static analysis tool and my code review.
>>
>> Signed-off-by: Jia-Ju Bai<baijiaju1990 at 163.com>
> This doesn't happen.  try_to_load_firmware() aborts before the
> request_firmware() call when chip == NULL, which is the case from
> sendcmd().



More information about the Alsa-devel mailing list