Put panic() calls under INVARIANTS.

This commit is contained in:
Michael Tuexen 2016-04-18 09:29:14 +00:00
parent b97b6d27f2
commit 98d5fd976b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298199
3 changed files with 26 additions and 0 deletions

View File

@ -570,9 +570,11 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb,
sctp_ucount_decr(asoc->cnt_on_all_streams);
if (control->on_strm_q == SCTP_ON_ORDERED) {
TAILQ_REMOVE(&strm->inqueue, control, next_instrm);
#ifdef INVARIANTS
} else {
panic("Huh control: %p is on_strm_q: %d",
control, control->on_strm_q);
#endif
}
control->on_strm_q = 0;
strm->last_sequence_delivered++;
@ -674,7 +676,11 @@ sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m)
stcb = control->stcb;
if (stcb == NULL) {
#ifdef INVARIANTS
panic("Control broken");
#else
return;
#endif
}
if (control->tail_mbuf == NULL) {
/* TSNH */
@ -1020,10 +1026,12 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, s
if (control->end_added) {
/* We just put the last bit on */
if (control->on_strm_q) {
#ifdef INVARIANTS
if (control->on_strm_q != SCTP_ON_UNORDERED) {
panic("Huh control: %p on_q: %d -- not unordered?",
control, control->on_strm_q);
}
#endif
TAILQ_REMOVE(&strm->uno_inqueue, control, next_instrm);
control->on_strm_q = 0;
}
@ -1072,10 +1080,12 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, s
strm->last_sequence_delivered);
if (control->end_added) {
if (control->on_strm_q) {
#ifdef INVARIANTS
if (control->on_strm_q != SCTP_ON_ORDERED) {
panic("Huh control: %p on_q: %d -- not ordered?",
control, control->on_strm_q);
}
#endif
TAILQ_REMOVE(&strm->inqueue, control, next_instrm);
control->on_strm_q = 0;
}
@ -1113,10 +1123,12 @@ sctp_deliver_reasm_check(struct sctp_tcb *stcb, struct sctp_association *asoc, s
if (control->end_added) {
/* We are done with it afterwards */
if (control->on_strm_q) {
#ifdef INVARIANTS
if (control->on_strm_q != SCTP_ON_ORDERED) {
panic("Huh control: %p on_q: %d -- not ordered?",
control, control->on_strm_q);
}
#endif
TAILQ_REMOVE(&strm->inqueue, control, next_instrm);
control->on_strm_q = 0;
}
@ -1210,9 +1222,11 @@ sctp_add_chk_to_control(struct sctp_queued_to_read *control,
/* Ordered */
TAILQ_REMOVE(&strm->inqueue, control, next_instrm);
control->on_strm_q = 0;
#ifdef INVARIANTS
} else if (control->on_strm_q) {
panic("Unknown state on ctrl: %p on_strm_q: %d", control,
control->on_strm_q);
#endif
}
}
control->end_added = 1;
@ -5167,9 +5181,11 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
TAILQ_REMOVE(&strmin->inqueue, ctl, next_instrm);
} else if (ctl->on_strm_q == SCTP_ON_UNORDERED) {
TAILQ_REMOVE(&strmin->uno_inqueue, ctl, next_instrm);
#ifdef INVARIANTS
} else {
panic("strmin: %p ctl: %p unknown %d",
strmin, ctl, ctl->on_strm_q);
#endif
}
ctl->on_strm_q = 0;
}
@ -5230,9 +5246,11 @@ sctp_kick_prsctp_reorder_queue(struct sctp_tcb *stcb,
TAILQ_REMOVE(&strmin->inqueue, ctl, next_instrm);
} else if (ctl->on_strm_q == SCTP_ON_UNORDERED) {
TAILQ_REMOVE(&strmin->uno_inqueue, ctl, next_instrm);
#ifdef INVARIANTS
} else {
panic("strmin: %p ctl: %p unknown %d",
strmin, ctl, ctl->on_strm_q);
#endif
}
ctl->on_strm_q = 0;
}
@ -5493,9 +5511,11 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
TAILQ_REMOVE(&strm->inqueue, ctl, next_instrm);
} else if (ctl->on_strm_q == SCTP_ON_UNORDERED) {
TAILQ_REMOVE(&strm->uno_inqueue, ctl, next_instrm);
#ifdef INVARIANTS
} else if (ctl->on_strm_q) {
panic("strm: %p ctl: %p unknown %d",
strm, ctl, ctl->on_strm_q);
#endif
}
ctl->on_strm_q = 0;
stcb->asoc.control_pdapi = ctl;

View File

@ -900,10 +900,12 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp,
/* Ordered */
TAILQ_REMOVE(&strm->inqueue, asoc->control_pdapi, next_instrm);
asoc->control_pdapi->on_strm_q = 0;
#ifdef INVARIANTS
} else {
panic("Unknown state on ctrl:%p on_strm_q:%d",
asoc->control_pdapi,
asoc->control_pdapi->on_strm_q);
#endif
}
}
asoc->control_pdapi->end_added = 1;

View File

@ -5565,10 +5565,12 @@ sctp_sorecvmsg(struct socket *so,
sctp_m_free(control->aux_data);
control->aux_data = NULL;
}
#ifdef INVARIANTS
if (control->on_strm_q) {
panic("About to free ctl:%p so:%p and its in %d",
control, so, control->on_strm_q);
}
#endif
sctp_free_remote_addr(control->whoFrom);
sctp_free_a_readq(stcb, control);
if (hold_rlock) {
@ -5976,10 +5978,12 @@ sctp_sorecvmsg(struct socket *so,
no_rcv_needed = control->do_not_ref_stcb;
sctp_free_remote_addr(control->whoFrom);
control->data = NULL;
#ifdef INVARIANTS
if (control->on_strm_q) {
panic("About to free ctl:%p so:%p and its in %d",
control, so, control->on_strm_q);
}
#endif
sctp_free_a_readq(stcb, control);
control = NULL;
if ((freed_so_far >= rwnd_req) &&