]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Merge branch 'for-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Nov 2017 20:26:49 +0000 (12:26 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Nov 2017 20:26:49 +0000 (12:26 -0800)
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

1  2 
kernel/workqueue_internal.h

index efdd72e15794eb2fca6afbbe28612d1fdd3288d6,29fa81f0f51a72c4305b7ca902f5e991b9b2bb2e..d390d1be37489f37bd8ac42826a12782a4ca99dc
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /*
   * kernel/workqueue_internal.h
   *
@@@ -10,6 -9,7 +10,7 @@@
  
  #include <linux/workqueue.h>
  #include <linux/kthread.h>
+ #include <linux/preempt.h>
  
  struct worker_pool;
  
@@@ -60,7 -60,7 +61,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;
  }