Skip to content

Commit

Permalink
dlm: free workqueues after the connections
Browse files Browse the repository at this point in the history
After backporting commit ee44b4b ("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 0d737a8 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.

Cc: stable@vger.kernel.org
Fixes: 0d737a8 ("dlm: fix race while closing connections")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Marcelo Ricardo Leitner authored and David Teigland committed Oct 10, 2016
1 parent c8d2bc9 commit 3a8db79
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,16 +1656,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);
}

Expand Down

0 comments on commit 3a8db79

Please sign in to comment.