From e255f0c9fbd2e1b27f57459d3af18fa19166969d Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Sun, 20 Feb 2022 15:31:53 +0100 Subject: [PATCH] sctp: make sure new locking requirements are satisfied. Reported by: syzbot+cd3c1dd64861b8c200bd@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet/sctp_output.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 86cf2ed75e90..43804b161cda 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -13321,6 +13321,10 @@ skip_preblock: sp->processing = 0; } SCTP_TCB_SEND_UNLOCK(stcb); + if (!hold_tcblock) { + SCTP_TCB_LOCK(stcb); + hold_tcblock = true; + } goto skip_out_eof; } /* What about the INIT, send it maybe */ @@ -13513,8 +13517,8 @@ skip_preblock: if (error != 0) { goto out; } -dataless_eof: +dataless_eof: KASSERT(stcb != NULL, ("stcb is NULL")); KASSERT(hold_tcblock, ("hold_tcblock is false")); SCTP_TCB_LOCK_ASSERT(stcb); @@ -13602,6 +13606,7 @@ dataless_eof: } } } + skip_out_eof: KASSERT(stcb != NULL, ("stcb is NULL")); KASSERT(hold_tcblock, ("hold_tcblock is false"));