]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
workqueue: Try to catch flush_work() without INIT_WORK().
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Wed, 23 Jan 2019 00:44:12 +0000 (09:44 +0900)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 2 Jul 2019 10:07:53 +0000 (12:07 +0200)
commitb6315b9bea5f482dc5fecb0fad98c0f8e3e81103
treeeca43e304661c74c783359535e0075925ef6100e
parent96426aac00c7f0b28eb4e42e4056b3cbb63fcbc6
workqueue: Try to catch flush_work() without INIT_WORK().

BugLink: https://bugs.launchpad.net/bugs/1830929
commit 4d43d395fed124631ca02356c711facb90185175 upstream.

syzbot found a flush_work() caller who forgot to call INIT_WORK()
because that work_struct was allocated by kzalloc() [1]. But the message

  INFO: trying to register non-static key.
  the code is fine but needs lockdep annotation.
  turning off the locking correctness validator.

by lock_map_acquire() is failing to tell that INIT_WORK() is missing.

Since flush_work() without INIT_WORK() is a bug, and INIT_WORK() should
set ->func field to non-zero, let's warn if ->func field is zero.

[1] https://syzkaller.appspot.com/bug?id=a5954455fcfa51c29ca2ab55b203076337e1c770

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
kernel/workqueue.c