git: 52106f072fd0 - main - sctp: don't refer to a potentially outdated stream

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sat, 02 Apr 2022 21:28:51 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=52106f072fd06890fd50ce1a232cbf522ae2155c

commit 52106f072fd06890fd50ce1a232cbf522ae2155c
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-04-02 21:26:27 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-04-02 21:26:27 +0000

    sctp: don't refer to a potentially outdated stream
    
    Reported by:    syzbot+1593381019112e5bb35c@syzkaller.appspotmail.com
    MFC after:      3 days
---
 sys/netinet/sctp_output.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index d1386eb767aa..9a8927160441 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -13401,6 +13401,8 @@ skip_preblock:
 		KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0,
 		    ("Association was aborted"));
 
+		/* The out streams might be reallocated. */
+		strm = &asoc->strmout[srcv->sinfo_stream];
 		if (sp != NULL) {
 			if (sp->msg_is_complete == 0) {
 				strm->last_msg_incomplete = 1;