sctp: add some asserts, no functional changes intended

This might help in narrowing down
https://syzkaller.appspot.com/bug?id=fbd79abaec55f5aede63937182f4247006ea883b
This commit is contained in:
Michael Tuexen 2021-11-26 12:19:33 +01:00
parent ecff38de76
commit 0906362646

View File

@ -1519,7 +1519,7 @@ sctp_iterator_work(struct sctp_iterator *it)
SCTP_INP_RUNLOCK(it->inp);
goto no_stcb;
}
while (it->stcb) {
while (it->stcb != NULL) {
SCTP_TCB_LOCK(it->stcb);
if (it->asoc_state && ((it->stcb->asoc.state & it->asoc_state) != it->asoc_state)) {
/* not in the right state... keep looking */
@ -1566,16 +1566,23 @@ sctp_iterator_work(struct sctp_iterator *it)
KASSERT(it->inp == it->stcb->sctp_ep,
("%s: stcb %p does not belong to inp %p, but inp %p",
__func__, it->stcb, it->inp, it->stcb->sctp_ep));
SCTP_INP_RLOCK_ASSERT(it->inp);
SCTP_TCB_LOCK_ASSERT(it->stcb);
/* run function on this one */
(*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val);
SCTP_INP_RLOCK_ASSERT(it->inp);
SCTP_TCB_LOCK_ASSERT(it->stcb);
/*
* we lie here, it really needs to have its own type but
* first I must verify that this won't effect things :-0
*/
if (it->no_chunk_output == 0)
if (it->no_chunk_output == 0) {
sctp_chunk_output(it->inp, it->stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED);
SCTP_INP_RLOCK_ASSERT(it->inp);
SCTP_TCB_LOCK_ASSERT(it->stcb);
}
SCTP_TCB_UNLOCK(it->stcb);
next_assoc: