Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2025 02:31:55 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a1be7978f187 - main - netisr: avoid VNET recursion warning in netisr_register()
Message-ID:  <202501170231.50H2VtNN044464@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by glebius:

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

commit a1be7978f1879313c141882a1e0812b468dead57
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-17 02:31:15 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-17 02:31:15 +0000

    netisr: avoid VNET recursion warning in netisr_register()
    
    While here, move some assertions to the top of the function.
---
 sys/net/netisr.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 4ae1aa9ab89d..e9b8fa4d833c 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -395,6 +395,9 @@ netisr_register(const struct netisr_handler *nhp)
 	/*
 	 * Test that the requested registration is valid.
 	 */
+	CURVNET_ASSERT_SET();
+	KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p",
+	    __func__, curvnet, vnet0));
 	KASSERT(nhp->nh_name != NULL,
 	    ("%s: nh_name NULL for %u", __func__, proto));
 	KASSERT(nhp->nh_handler != NULL,
@@ -454,15 +457,12 @@ netisr_register(const struct netisr_handler *nhp)
 		npwp->nw_qlimit = netisr_proto[proto].np_qlimit;
 	}
 
+	V_netisr_enable[proto] = 1;
 #ifdef VIMAGE
-	/*
-	 * Test that we are in vnet0 and have a curvnet set.
-	 */
-	KASSERT(curvnet != NULL, ("%s: curvnet is NULL", __func__));
-	KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p",
-	    __func__, curvnet, vnet0));
 	VNET_LIST_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
+		if (vnet_iter == curvnet)
+			continue;
 		CURVNET_SET(vnet_iter);
 		V_netisr_enable[proto] = 1;
 		CURVNET_RESTORE();


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501170231.50H2VtNN044464>