Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b355516f authored by David Windsor's avatar David Windsor Committed by David Teigland
Browse files

dlm: check if workqueues are NULL before flushing/destroying



If the DLM lowcomms stack is shut down before any DLM
traffic can be generated, flush_workqueue() and
destroy_workqueue() can be called on empty send and/or recv
workqueues.

Insert guard conditionals to only call flush_workqueue()
and destroy_workqueue() on workqueues that are not NULL.

Signed-off-by: default avatarDavid Windsor <dwindsor@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent d1fdb6d8
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -1628,7 +1628,9 @@ static void clean_writequeues(void)

static void work_stop(void)
{
	if (recv_workqueue)
		destroy_workqueue(recv_workqueue);
	if (send_workqueue)
		destroy_workqueue(send_workqueue);
}

@@ -1689,12 +1691,16 @@ static void work_flush(void)
	struct hlist_node *n;
	struct connection *con;

	if (recv_workqueue)
		flush_workqueue(recv_workqueue);
	if (send_workqueue)
		flush_workqueue(send_workqueue);
	do {
		ok = 1;
		foreach_conn(stop_conn);
		if (recv_workqueue)
			flush_workqueue(recv_workqueue);
		if (send_workqueue)
			flush_workqueue(send_workqueue);
		for (i = 0; i < CONN_HASH_SIZE && ok; i++) {
			hlist_for_each_entry_safe(con, n,