aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-07-29 13:19:08 +0000
committerMark Johnston <markj@FreeBSD.org>2026-07-29 13:19:08 +0000
commitb6823a973737f06ea6cf0ea5a3083383af2ba5a4 (patch)
treee9fb118eaa77c40ef0df9cb37bf60e8765517ff8
parent1d7b0514225479ecbed8c4bc2258ce0356d20bc1 (diff)
ipsec: Fix a lock leak in ipsec_chkreplay()
Reported by: Chris Jarrett-Davies of the OpenAI Codex Security Team Reviewed by: pouria, kp Fixes: 0361f165f219 ("ipsec: replace SECASVAR mtx by rmlock") MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58521
-rw-r--r--sys/netipsec/ipsec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c
index 92d0201b398a..12d1b7945e64 100644
--- a/sys/netipsec/ipsec.c
+++ b/sys/netipsec/ipsec.c
@@ -1353,8 +1353,10 @@ ipsec_chkreplay(uint32_t seq, uint32_t *seqhigh, struct secasvar *sav)
* subspace.
*/
if (tl < window - 1 && seq >= bl) {
- if (th == 0)
+ if (th == 0) {
+ SECREPLAY_UNLOCK(replay);
return (0);
+ }
*seqhigh = th - 1;
seqh = th - 1;
if (check_window(replay, seq)) {