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 11:16:55 +0000 (13:16 +0200)
commit0a177079947431cd8f47993e15a00df8ba19e617
tree880a42ab27fd0295e1d8270f4e9223f589c3b599
parentce7a7bd7849d8d5aa5131c0f0eb14a250a584179
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