git: f0c8e8118dbc - main - sctp: cleanup

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 25 Aug 2023 15:28:20 UTC
The branch main has been updated by tuexen:

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

commit f0c8e8118dbcc9251b11154ee7e4680f79901af1
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2023-08-25 15:23:34 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-08-25 15:26:58 +0000

    sctp: cleanup
    
    No functional change intended. Just asserting the conditions when
    being called.
    
    MFC after:      1 week
---
 sys/netinet/sctp_timer.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index ef5eb8b89a5d..d0f3f936b34d 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -87,7 +87,10 @@ static int
 sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
     struct sctp_nets *net, uint16_t threshold)
 {
-	if (net) {
+	KASSERT(stcb != NULL, ("stcb is NULL"));
+	SCTP_TCB_LOCK_ASSERT(stcb);
+
+	if (net != NULL) {
 		net->error_count++;
 		SCTPDBG(SCTP_DEBUG_TIMER4, "Error count for %p now %d thresh:%d\n",
 		    (void *)net, net->error_count,
@@ -114,11 +117,6 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
 				sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
 			}
 		}
-	}
-	if (stcb == NULL)
-		return (0);
-
-	if (net) {
 		if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) {
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_THRESHOLD_LOGGING) {
 				sctp_misc_ints(SCTP_THRESHOLD_INCR,