]> git.baikalelectronics.ru Git - kernel.git/commit
workqueue: Fix pwq ref leak in rescuer_thread()
authorTejun Heo <tj@kernel.org>
Wed, 25 Sep 2019 13:59:15 +0000 (06:59 -0700)
committerTejun Heo <tj@kernel.org>
Fri, 4 Oct 2019 17:23:11 +0000 (10:23 -0700)
commit03a569ea35aaab8fd91e2dff10e4f90e0277968d
tree2d3a35b03b4cb4b318e402f39743ab26b9de0f6d
parent07d9fcf14d3047929915a200fe6217153cb5e38e
workqueue: Fix pwq ref leak in rescuer_thread()

279006bfd9d ("workqueue: allow rescuer thread to do more work.") made
the rescuer worker requeue the pwq immediately if there may be more
work items which need rescuing instead of waiting for the next mayday
timer expiration.  Unfortunately, it doesn't check whether the pwq is
already on the mayday list and unconditionally gets the ref and moves
it onto the list.  This doesn't corrupt the list but creates an
additional reference to the pwq.  It got queued twice but will only be
removed once.

This leak later can trigger pwq refcnt warning on workqueue
destruction and prevent freeing of the workqueue.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "Williams, Gerald S" <gerald.s.williams@intel.com>
Cc: NeilBrown <neilb@suse.de>
Cc: stable@vger.kernel.org # v3.19+
kernel/workqueue.c