aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2024-08-30 11:36:39 +0000
committerKristof Provost <kp@FreeBSD.org>2024-09-04 08:38:15 +0000
commit38f74de7184ac3ad7acc48055551aaa9ec9cded9 (patch)
tree4d8c033067cc863902e44bd5a68394a35223dedf /sys/net
parentb822e3fab468ffbe941d0758d960e1aa46069a38 (diff)
pf: rework pf_icmp_state_lookup() failure mode
If pf_icmp_state_lookup() finds a state but rejects it for not matching the expected direction we should unlock the state (and NULL out *state). This simplifies life for callers, and also ensures there's no confusion about what a non-NULL returned state means. Previously it could have been left in there by the caller, resulting in callers unlocking the same state twice. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 0578fe492284ded4745167060be794032e6e22f0)
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pfvar.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index d33c747efa7e..290f339e7d00 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -359,8 +359,8 @@ struct pfi_dynaddr {
mtx_unlock(_s->lock); \
} while (0)
#else
-#define PF_STATE_LOCK(s) mtx_lock(s->lock)
-#define PF_STATE_UNLOCK(s) mtx_unlock(s->lock)
+#define PF_STATE_LOCK(s) mtx_lock((s)->lock)
+#define PF_STATE_UNLOCK(s) mtx_unlock((s)->lock)
#endif
#ifdef INVARIANTS