diff options
author | Michael Tuexen <tuexen@fh-muenster.de> | 2020-05-11 00:58:36 +0200 |
---|---|---|
committer | Michael Tuexen <tuexen@fh-muenster.de> | 2020-05-11 00:58:36 +0200 |
commit | 9d5b315143fe269adb288419b43a29ab878925e9 (patch) | |
tree | 4eb432ce307ef95593b6bfabc1e246bd7812939d | |
parent | a8f3d9da2fcb96e1c9c4a32cece5e7d9ed6e3086 (diff) | |
download | usrsctp-9d5b315143fe269adb288419b43a29ab878925e9.tar.gz |
Ensure the stcb belongs to the inp when running the iterator.
-rwxr-xr-x | usrsctplib/netinet/sctputil.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usrsctplib/netinet/sctputil.c b/usrsctplib/netinet/sctputil.c index 2953f3a1..9a0332b4 100755 --- a/usrsctplib/netinet/sctputil.c +++ b/usrsctplib/netinet/sctputil.c @@ -34,7 +34,7 @@ #ifdef __FreeBSD__ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 360878 2020-05-10 17:19:19Z tuexen $"); +__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 360885 2020-05-10 22:54:30Z tuexen $"); #endif #include <netinet/sctp_os.h> @@ -1543,6 +1543,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; @@ -1618,6 +1619,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); @@ -1650,6 +1654,7 @@ select_a_new_ep: } else { it->inp = LIST_NEXT(it->inp, sctp_list); } + it->stcb = NULL; if (it->inp == NULL) { goto done_with_iterator; } |