Clear pointer to stack when leaving function
@@ -14043,7 +14043,6 @@ sctp_lower_sosend(struct socket *so,
SCTP_TCB_UNLOCK(stcb);
hold_tcblock = false;
error = sbwait(&so->so_snd);
- if (error || so->so_error || be.error) {
if (error == 0) {
if (so->so_error != 0) {
error = so->so_error;
@@ -14053,11 +14052,12 @@ sctp_lower_sosend(struct socket *so,
}
}
SOCKBUF_UNLOCK(&so->so_snd);
- goto out_unlocked;
- }
- SOCKBUF_UNLOCK(&so->so_snd);
SCTP_TCB_LOCK(stcb);
hold_tcblock = true;
+ stcb->block_entry = NULL;
+ if (error != 0) {
+ goto out_unlocked;
+ }
if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) ||
(asoc->state & SCTP_STATE_WAS_ABORTED)) {
if (asoc->state & SCTP_STATE_WAS_ABORTED) {
@@ -14068,7 +14068,6 @@ sctp_lower_sosend(struct socket *so,
}
goto out_unlocked;
}
- stcb->block_entry = NULL;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) {
sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK,
asoc, asoc->total_output_queue_size);
@@ -14457,14 +14456,19 @@ skip_preblock:
sbunlock(&so->so_snd, 1);
#endif
error = sbwait(&so->so_snd);
- if (error || so->so_error || be.error) {
if (error == 0) {
- if (so->so_error)
+ if (so->so_error != 0)
error = so->so_error;
- if (be.error) {
+ if (be.error != 0) {
error = be.error;
}
}
+#if defined(__APPLE__) && !defined(__Userspace__)
+ if (error == 0) {
+ error = sblock(&so->so_snd, SBLOCKWAIT(flags));
+ }
+#endif
+ if (error != 0) {
SOCKBUF_UNLOCK(&so->so_snd);
SCTP_TCB_LOCK(stcb);
hold_tcblock = true;
@@ -14476,15 +14480,12 @@ skip_preblock:
}
goto out_unlocked;
}
-
-#if defined(__APPLE__) && !defined(__Userspace__)
- error = sblock(&so->so_snd, SBLOCKWAIT(flags));
-#endif
}
SOCKBUF_UNLOCK(&so->so_snd);
if (!hold_tcblock) {
SCTP_TCB_LOCK(stcb);
hold_tcblock = true;
+ stcb->block_entry = NULL;
if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) ||
(asoc->state & SCTP_STATE_WAS_ABORTED)) {
if (asoc->state & SCTP_STATE_WAS_ABORTED) {
@@ -14496,7 +14497,6 @@ skip_preblock:
goto out;
}
}
- stcb->block_entry = NULL;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_BLK_LOGGING_ENABLE) {
sctp_log_block(SCTP_BLOCK_LOG_OUTOF_BLK,
asoc, asoc->total_output_queue_size);
