workqueue fix for v4.14-rc8
Tejun Heo
maintainerHello, Linus.
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.
Thanks.
The following changes since commit 692b48258dda7c302e777d7d5f4217244478f1f6:
workqueue: replace pool->manager_arb mutex with a flag (2017-10-10 07:13:57 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-4.14-fixes
for you to fetch changes up to cef572ad9bd7f85035ba8272e5352040e8be0152:
workqueue: Fix NULL pointer dereference (2017-10-30 07:56:01 -0700)
----------------------------------------------------------------
Li Bin (1):
workqueue: Fix NULL pointer dereference
kernel/workqueue_internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/workqueue_internal.h +2 -1
@@ -9,6 +9,7 @@#include <linux/workqueue.h> #include <linux/kthread.h> +#include <linux/preempt.h> struct worker_pool ;
@@ -59,7 +60,7 @@ struct worker {*/ static inline struct worker *current_wq_worker (void ) { -if (current->flags &PF_WQ_WORKER ) +if (in_task () && (current->flags &PF_WQ_WORKER ))return kthread_data (current);return NULL ; }