git: 8a9269edd71a - main - ipsec: sprinkle CURVNET_ASSERT_SET

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Sat, 19 Feb 2022 13:11:17 UTC
The branch main has been updated by mjg:

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

commit 8a9269edd71a035384a5c97ab2d1a437691a3d87
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-02-17 16:53:15 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-02-19 13:10:41 +0000

    ipsec: sprinkle CURVNET_ASSERT_SET
    
    Reviewed by:    ae
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D34314
---
 sys/netipsec/key.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 480879a58aa4..7e75caf4f4ee 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -1357,6 +1357,7 @@ key_freesav(struct secasvar **psav)
 	struct secasvar *sav = *psav;
 
 	IPSEC_ASSERT(sav != NULL, ("null sav"));
+	CURVNET_ASSERT_SET();
 	if (SAV_DELREF(sav) == 0)
 		return;
 
@@ -1380,6 +1381,7 @@ key_unlinksav(struct secasvar *sav)
 	KEYDBG(KEY_STAMP,
 	    printf("%s: SA(%p)\n", __func__, sav));
 
+	CURVNET_ASSERT_SET();
 	SAHTREE_UNLOCK_ASSERT();
 	SAHTREE_WLOCK();
 	if (sav->state == SADB_SASTATE_DEAD) {
@@ -2890,6 +2892,8 @@ key_freesah(struct secashead **psah)
 {
 	struct secashead *sah = *psah;
 
+	CURVNET_ASSERT_SET();
+
 	if (SAH_DELREF(sah) == 0)
 		return;