fs: dlm: fix race between test_bit() and queue_work()
authorAlexander Aring <aahringo@redhat.com>
Mon, 15 Aug 2022 19:43:14 +0000 (15:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:20 +0000 (12:34 +0200)
commit34ed22dd286073651dd114249bf54bed2802d3a5
tree5ef5666ca960b6de5eed658db3c63c5c52293c17
parent7fa5304c4b5b425d4a0b3acf10139a7f6108a85f
fs: dlm: fix race between test_bit() and queue_work()

commit eef6ec9bf390e836a6c4029f3620fe49528aa1fe upstream.

This patch fixes a race by using ls_cb_mutex around the bit
operations and conditional code blocks for LSFL_CB_DELAY.

The function dlm_callback_stop() expects to stop all callbacks and
flush all currently queued onces. The set_bit() is not enough because
there can still be queue_work() after the workqueue was flushed.
To avoid queue_work() after set_bit(), surround both by ls_cb_mutex.

Cc: stable@vger.kernel.org
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/dlm/ast.c