git: e255f0c9fbd2 - main - sctp: make sure new locking requirements are satisfied.

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Sun, 20 Feb 2022 14:36:37 UTC
The branch main has been updated by tuexen:

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

commit e255f0c9fbd2e1b27f57459d3af18fa19166969d
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2022-02-20 14:31:53 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-20 14:36:26 +0000

    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"));