diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-06 15:26:49 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-06 15:26:49 -0500 |
| commit | e4880bc5dfb1f02b152e62a894b5c6f3e995b3cf (patch) | |
| tree | d49f90a4fd53973af7609fcd0958bb7528cdf5bf /kernel | |
| parent | 136fc5c41f349296db1910677bb7402b0eeff376 (diff) | |
| parent | cef572ad9bd7f85035ba8272e5352040e8be0152 (diff) | |
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
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/workqueue_internal.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h index efdd72e15794..d390d1be3748 100644 --- a/kernel/workqueue_internal.h +++ b/kernel/workqueue_internal.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
| 12 | #include <linux/kthread.h> | 12 | #include <linux/kthread.h> |
| 13 | #include <linux/preempt.h> | ||
| 13 | 14 | ||
| 14 | struct worker_pool; | 15 | struct worker_pool; |
| 15 | 16 | ||
| @@ -60,7 +61,7 @@ struct worker { | |||
| 60 | */ | 61 | */ |
| 61 | static inline struct worker *current_wq_worker(void) | 62 | static inline struct worker *current_wq_worker(void) |
| 62 | { | 63 | { |
| 63 | if (current->flags & PF_WQ_WORKER) | 64 | if (in_task() && (current->flags & PF_WQ_WORKER)) |
| 64 | return kthread_data(current); | 65 | return kthread_data(current); |
| 65 | return NULL; | 66 | return NULL; |
| 66 | } | 67 | } |
