git: 36f42c5ebf69 - main - tcp_ccalgounload(): initialize the inpcb iterator when curvnet is set

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 03 Dec 2021 20:40:52 UTC
The branch main has been updated by glebius:

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

commit 36f42c5ebf69bc4f135b00427f807a6cfce7f99c
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-12-03 20:39:56 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-12-03 20:39:56 +0000

    tcp_ccalgounload(): initialize the inpcb iterator when curvnet is set
    
    Pointy hat to:  glebius
    Fixes:          de2d47842e88
---
 sys/netinet/tcp_subr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 86417aad5836..1ce8cddc30e1 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -2303,8 +2303,6 @@ tcp_ccalgounload(struct cc_algo *unload_algo)
 	struct inpcb *inp;
 	struct tcpcb *tp;
 	VNET_ITERATOR_DECL(vnet_iter);
-	struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
-	    INPLOOKUP_WLOCKPCB);
 
 	/*
 	 * Check all active control blocks across all network stacks and change
@@ -2314,6 +2312,8 @@ tcp_ccalgounload(struct cc_algo *unload_algo)
 	VNET_LIST_RLOCK();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
+		struct inpcb_iterator inpi = INP_ALL_ITERATOR(&V_tcbinfo,
+		    INPLOOKUP_WLOCKPCB);
 		/*
 		 * XXXGL: would new accept(2)d connections use algo being
 		 * unloaded?