Skip to content

Commit

Permalink
Lock ACCEPT_LOCK before checking socket->so_head. (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLennox committed Apr 17, 2024
1 parent e8da239 commit 5335d22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions usrsctplib/netinet/sctp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -5934,6 +5934,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
if ((stcb != NULL) &&
((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) &&
(stcb->sctp_socket != NULL)) {
ACCEPT_LOCK();
if (stcb->sctp_socket->so_head != NULL) {
upcall_socket = stcb->sctp_socket->so_head;
} else {
Expand All @@ -5942,6 +5943,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
SOCK_LOCK(upcall_socket);
soref(upcall_socket);
SOCK_UNLOCK(upcall_socket);
ACCEPT_UNLOCK();
}
#endif
if (IS_SCTP_CONTROL(ch)) {
Expand Down Expand Up @@ -6037,6 +6039,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
if ((upcall_socket == NULL) &&
((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) &&
(stcb->sctp_socket != NULL)) {
ACCEPT_LOCK();
if (stcb->sctp_socket->so_head != NULL) {
upcall_socket = stcb->sctp_socket->so_head;
} else {
Expand All @@ -6045,6 +6048,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int lengt
SOCK_LOCK(upcall_socket);
soref(upcall_socket);
SOCK_UNLOCK(upcall_socket);
ACCEPT_UNLOCK();
}
#endif

Expand Down

0 comments on commit 5335d22

Please sign in to comment.