Commit 1832397d authored by Marcelo Ricardo Leitner's avatar Marcelo Ricardo Leitner Committed by Greg Kroah-Hartman

dlm: free workqueues after the connections

commit 3a8db798 upstream.

After backporting commit ee44b4bc ("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 0d737a8c 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: 0d737a8c ("dlm: fix race while closing connections")
Signed-off-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 78e1355d
...@@ -1607,16 +1607,12 @@ void dlm_lowcomms_stop(void) ...@@ -1607,16 +1607,12 @@ void dlm_lowcomms_stop(void)
mutex_lock(&connections_lock); mutex_lock(&connections_lock);
dlm_allow_conn = 0; dlm_allow_conn = 0;
foreach_conn(stop_conn); foreach_conn(stop_conn);
clean_writequeues();
foreach_conn(free_conn);
mutex_unlock(&connections_lock); mutex_unlock(&connections_lock);
work_stop(); work_stop();
mutex_lock(&connections_lock);
clean_writequeues();
foreach_conn(free_conn);
mutex_unlock(&connections_lock);
kmem_cache_destroy(con_cache); kmem_cache_destroy(con_cache);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment