Skip to content

Commit e4880bc

Browse files
committed
Merge branch 'for-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue fix from Tejun Heo: "Another fix for a really old bug. It only affects drain_workqueue() which isn't used often and even then triggers only during a pretty small race window, so it isn't too surprising that it stayed hidden for so long. The fix is straight-forward and low-risk. Kudos to Li Bin for reporting and fixing the bug" * 'for-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: Fix NULL pointer dereference
2 parents 136fc5c + cef572a commit e4880bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/workqueue_internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <linux/workqueue.h>
1212
#include <linux/kthread.h>
13+
#include <linux/preempt.h>
1314

1415
struct worker_pool;
1516

@@ -60,7 +61,7 @@ struct worker {
6061
*/
6162
static inline struct worker *current_wq_worker(void)
6263
{
63-
if (current->flags & PF_WQ_WORKER)
64+
if (in_task() && (current->flags & PF_WQ_WORKER))
6465
return kthread_data(current);
6566
return NULL;
6667
}

0 commit comments

Comments
 (0)