Skip to content

Commit fcef0e6

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: fix lowcomms_start error case
This patch fixes the error path handling in lowcomms_start(). We need to cleanup some static allocated data structure and cleanup possible workqueue if these have started. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 7d3848c commit fcef0e6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

fs/dlm/lowcomms.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,10 +1803,15 @@ static void process_send_sockets(struct work_struct *work)
18031803

18041804
static void work_stop(void)
18051805
{
1806-
if (recv_workqueue)
1806+
if (recv_workqueue) {
18071807
destroy_workqueue(recv_workqueue);
1808-
if (send_workqueue)
1808+
recv_workqueue = NULL;
1809+
}
1810+
1811+
if (send_workqueue) {
18091812
destroy_workqueue(send_workqueue);
1813+
send_workqueue = NULL;
1814+
}
18101815
}
18111816

18121817
static int work_start(void)
@@ -1823,6 +1828,7 @@ static int work_start(void)
18231828
if (!send_workqueue) {
18241829
log_print("can't start dlm_send");
18251830
destroy_workqueue(recv_workqueue);
1831+
recv_workqueue = NULL;
18261832
return -ENOMEM;
18271833
}
18281834

@@ -1960,7 +1966,7 @@ int dlm_lowcomms_start(void)
19601966

19611967
error = work_start();
19621968
if (error)
1963-
goto fail;
1969+
goto fail_local;
19641970

19651971
dlm_allow_conn = 1;
19661972

@@ -1977,6 +1983,9 @@ int dlm_lowcomms_start(void)
19771983
fail_unlisten:
19781984
dlm_allow_conn = 0;
19791985
dlm_close_sock(&listen_con.sock);
1986+
work_stop();
1987+
fail_local:
1988+
deinit_local();
19801989
fail:
19811990
return error;
19821991
}

0 commit comments

Comments
 (0)