Date: Sun, 10 May 2020 22:54:30 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360885 - head/sys/netinet Message-ID: <202005102254.04AMsUBW098985@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005102254.04AMsUBW098985>