git: 2f4109acd8bc - stable/13 - sctp: don't refer to a potentially outdated stream

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 01 Feb 2023 22:31:17 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f4109acd8bc705ece55117a4f421a8a2bbf0b56

commit 2f4109acd8bc705ece55117a4f421a8a2bbf0b56
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-04-02 21:26:27 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-02-01 22:30:56 +0000

    sctp: don't refer to a potentially outdated stream
    
    Reported by:    syzbot+1593381019112e5bb35c@syzkaller.appspotmail.com
    
    (cherry picked from commit 52106f072fd06890fd50ce1a232cbf522ae2155c)
---
 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 3458da7e0578..63310a6cc48b 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -13399,6 +13399,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;