diff options
author | Michael Tuexen <tuexen@FreeBSD.org> | 2020-05-10 22:54:30 +0000 |
---|---|---|
committer | Michael Tuexen <tuexen@FreeBSD.org> | 2020-05-10 22:54:30 +0000 |
commit | 83ed508055c04a990725159a68d4451881c1370c (patch) | |
tree | c155bab9b06102f391640e89661c3567af55b806 | |
parent | a93817e04fd5b0dd8a1df90a98f729a2b90adef6 (diff) | |
download | src-83ed508055c04a990725159a68d4451881c1370c.tar.gz src-83ed508055c04a990725159a68d4451881c1370c.zip |
Ensure that the SCTP iterator runs with an stcb and inp, which belong to
each other.
Reported by: syzbot+82d39d14f2f765e38db0@syzkaller.appspotmail.com
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=360885
-rw-r--r-- | sys/netinet/sctputil.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index b757a2163dca..980b09093e25 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1489,6 +1489,7 @@ select_a_new_ep: } tinp = it->inp; it->inp = LIST_NEXT(it->inp, sctp_list); + it->stcb = NULL; SCTP_INP_RUNLOCK(tinp); if (it->inp == NULL) { goto done_with_iterator; @@ -1558,6 +1559,9 @@ select_a_new_ep: atomic_add_int(&it->stcb->asoc.refcnt, -1); iteration_count = 0; } + 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)); /* run function on this one */ (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); @@ -1590,6 +1594,7 @@ no_stcb: } else { it->inp = LIST_NEXT(it->inp, sctp_list); } + it->stcb = NULL; if (it->inp == NULL) { goto done_with_iterator; } |