svn commit: r360885 - head/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Sun May 10 22:54:30 UTC 2020
Author: tuexen
Date: Sun May 10 22:54:30 2020
New Revision: 360885
URL: https://svnweb.freebsd.org/changeset/base/360885
Log:
Ensure that the SCTP iterator runs with an stcb and inp, which belong to
each other.
Reported by: syzbot+82d39d14f2f765e38db0 at syzkaller.appspotmail.com
MFC after: 3 days
Modified:
head/sys/netinet/sctputil.c
Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c Sun May 10 21:37:39 2020 (r360884)
+++ head/sys/netinet/sctputil.c Sun May 10 22:54:30 2020 (r360885)
@@ -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;
}
More information about the svn-src-head
mailing list