summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2016-10-08 10:14:37 -0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-22 12:06:49 +0200
commit4530bf879b1dc5b1c74a6638510c9c80b9aaf5af (patch)
tree110e60bdb9bd5925e68ceffc04fcc38d9873ba27
parentc2a55c3a891ce8b6c1d06698f9b6d946db29a9f5 (diff)
downloadlinux-stable-4530bf879b1dc5b1c74a6638510c9c80b9aaf5af.tar.gz
linux-stable-4530bf879b1dc5b1c74a6638510c9c80b9aaf5af.tar.bz2
linux-stable-4530bf879b1dc5b1c74a6638510c9c80b9aaf5af.zip
dlm: free workqueues after the connections
commit 3a8db79889ce16930aff19b818f5b09651bb7644 upstream. After backporting commit ee44b4bc054a ("dlm: use sctp 1-to-1 API") series to a kernel with an older workqueue which didn't use RCU yet, it was noticed that we are freeing the workqueues in dlm_lowcomms_stop() too early as free_conn() will try to access that memory for canceling the queued works if any. This issue was introduced by commit 0d737a8cfd83 as before it such attempt to cancel the queued works wasn't performed, so the issue was not present. This patch fixes it by simply inverting the free order. Fixes: 0d737a8cfd83 ("dlm: fix race while closing connections") Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/dlm/lowcomms.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 1ab012a27d9f..be14bea958b4 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1657,16 +1657,12 @@ void dlm_lowcomms_stop(void)
mutex_lock(&connections_lock);
dlm_allow_conn = 0;
foreach_conn(stop_conn);
+ clean_writequeues();
+ foreach_conn(free_conn);
mutex_unlock(&connections_lock);
work_stop();
- mutex_lock(&connections_lock);
- clean_writequeues();
-
- foreach_conn(free_conn);
-
- mutex_unlock(&connections_lock);
kmem_cache_destroy(con_cache);
}