]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:40 +0000 (14:22 -0300)
commitc4c3c504ece98197d41faf59fbeaf7b4e7546de6
tree65db8b0028dc12d001e1e477df7acae59b6f849e
parentb72b086ca7fc7f29de5de825e3a462f732162988
workqueue: Fix pwq ref leak in rescuer_thread()

BugLink: https://bugs.launchpad.net/bugs/1857158
commit e66b39af00f426b3356b96433d620cb3367ba1ff upstream.

008847f66c3 ("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+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
kernel/workqueue.c