aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@fh-muenster.de>2023-08-24 16:02:30 +0200
committerMichael Tuexen <tuexen@fh-muenster.de>2023-08-24 16:02:30 +0200
commitad3017623161238e7b5e4bd2bd8784d2c2e141f1 (patch)
tree72f231d3da389fe9fbf07d95dae13f7bd8d21372
parentf4d3996035a3eb5c34de1c3eb95301b18dcf2841 (diff)
downloadusrsctp-ad3017623161238e7b5e4bd2bd8784d2c2e141f1.tar.gz
Improve handling of socket which was shutdown for reading
-rwxr-xr-xusrsctplib/netinet/sctp_indata.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/usrsctplib/netinet/sctp_indata.c b/usrsctplib/netinet/sctp_indata.c
index 9823f83..91980d3 100755
--- a/usrsctplib/netinet/sctp_indata.c
+++ b/usrsctplib/netinet/sctp_indata.c
@@ -1306,16 +1306,18 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control,
* data from the chk onto the control and free
* up the chunk resources.
*/
- uint32_t added=0;
- int i_locked = 0;
+ uint32_t added = 0;
+ bool i_locked = false;
- if (control->on_read_q && (hold_rlock == 0)) {
- /*
- * Its being pd-api'd so we must
- * do some locks.
- */
- SCTP_INP_READ_LOCK(stcb->sctp_ep);
- i_locked = 1;
+ if (control->on_read_q) {
+ if (hold_rlock == 0) {
+ /* Its being pd-api'd so we must do some locks. */
+ SCTP_INP_READ_LOCK(stcb->sctp_ep);
+ i_locked = true;
+ }
+ if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_CANT_READ) {
+ goto out;
+ }
}
if (control->data == NULL) {
control->data = chk->data;
@@ -1363,6 +1365,7 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control,
control->end_added = 1;
control->last_frag_seen = 1;
}
+out:
if (i_locked) {
SCTP_INP_READ_UNLOCK(stcb->sctp_ep);
}