Skip to content

Commit acee4e5

Browse files
marceloleitnerteigland
authored andcommitted
dlm: replace BUG_ON with a less severe handling
BUG_ON() is a severe action for this case, specially now that DLM with SCTP will use 1 socket per association. Instead, we can just close the socket on this error condition and return from the function. Also move the check to an earlier stage as it won't change and thus we can abort as soon as possible. Although this issue was reported when still using SCTP with 1-to-many API, this cleanup wouldn't be that simple back then because we couldn't close the socket and making sure such event would cease would be hard. And actually, previous code was closing the association, yet SCTP layer is still raising the new data event. Probably a bug to be fixed in SCTP. Reported-by: <tan.hu@zte.com.cn> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent ee44b4b commit acee4e5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎fs/dlm/lowcomms.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,10 @@ static int receive_from_sock(struct connection *con)
542542
ret = -EAGAIN;
543543
goto out_close;
544544
}
545+
if (con->nodeid == 0) {
546+
ret = -EINVAL;
547+
goto out_close;
548+
}
545549

546550
if (con->rx_page == NULL) {
547551
/*
@@ -582,8 +586,6 @@ static int receive_from_sock(struct connection *con)
582586
else if (ret == len)
583587
call_again_soon = 1;
584588

585-
BUG_ON(con->nodeid == 0);
586-
587589
cbuf_add(&con->cb, ret);
588590
ret = dlm_process_incoming_buffer(con->nodeid,
589591
page_address(con->rx_page),

0 commit comments

Comments
 (0)