[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d5821887-343a-1f56-08da-372e02546905@huawei.com>
Date: Tue, 24 Oct 2017 08:33:31 +0800
From: Li Bin <huawei.libin@...wei.com>
To: Tejun Heo <tj@...nel.org>
CC: tanxiaofei <tanxiaofei@...wei.com>, <jiangshanlai@...il.com>,
<linux-kernel@...r.kernel.org>, John Garry <john.garry@...wei.com>
Subject: Re: [Question] null pointer risk of kernel workqueue
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.
>
Powered by blists - more mailing lists