Re: [Question] null pointer risk of kernel workqueue

From: Li Bin
Date: Mon Oct 23 2017 - 20:49:53 EST




on 2017/10/23 22:03, Tejun Heo wrote:
>>
>> And I think the following patch can solve the bug, right?
>>
>> diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
>> index 8635417..650680c 100644
>> --- a/kernel/workqueue_internal.h
>> +++ b/kernel/workqueue_internal.h
>> @@ -59,7 +59,7 @@ struct worker {
>> */
>> static inline struct worker *current_wq_worker(void)
>> {
>> - if (current->flags & PF_WQ_WORKER)
>> + if (!in_irq() && (current->flags & PF_WQ_WORKER))
>> return kthread_data(current);
>> return NULL;
>> }
>
> Yeah, that makes sense to me. Can you please resend the patch with
> patch description and SOB?

Ok, I will resend the patch soon.

Thanks,
Li Bin

>
> Thanks.
>