diff options
| author | Michael Tuexen <tuexen@fh-muenster.de> | 2023-09-13 15:37:16 +0200 |
|---|---|---|
| committer | Michael Tuexen <tuexen@fh-muenster.de> | 2023-09-13 15:37:16 +0200 |
| commit | a0cbf4681474fab1e89d9e9e2d5c3694fce50359 (patch) | |
| tree | 95affd1ace8861e82514b665ff2c47abed3c01ee | |
| parent | 01bab70a7af7ae6ec47299595322de0419a78123 (diff) | |
Further improve shutting down the read side of a socket
| -rwxr-xr-x | usrsctplib/netinet/sctp_usrreq.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usrsctplib/netinet/sctp_usrreq.c b/usrsctplib/netinet/sctp_usrreq.c index e4261ef..df4424e 100755 --- a/usrsctplib/netinet/sctp_usrreq.c +++ b/usrsctplib/netinet/sctp_usrreq.c @@ -1289,11 +1289,9 @@ sctp_flush(struct socket *so, int how) return (0); } stcb = LIST_FIRST(&inp->sctp_asoc_list); - if (stcb == NULL) { - SCTP_INP_WUNLOCK(inp); - return (ENOTCONN); + if (stcb != NULL) { + SCTP_TCB_LOCK(stcb); } - SCTP_TCB_LOCK(stcb); SCTP_INP_READ_LOCK(inp); inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ; SOCK_LOCK(so); @@ -1319,7 +1317,7 @@ sctp_flush(struct socket *so, int how) } SOCK_UNLOCK(so); SCTP_INP_READ_UNLOCK(inp); - if (need_to_abort) { + if (need_to_abort && (stcb != NULL)) { inp->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; SCTP_INP_WUNLOCK(inp); op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); @@ -1332,7 +1330,9 @@ sctp_flush(struct socket *so, int how) #endif return (ECONNABORTED); } - SCTP_TCB_UNLOCK(stcb); + if (stcb != NULL) { + SCTP_TCB_UNLOCK(stcb); + } SCTP_INP_WUNLOCK(inp); return (0); } |
