git: 162c1ae57c84 - main - pf: fix double free on error
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Nov 2026 18:11:50 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=162c1ae57c84e118997f3577700b7adf19b6d3fd
commit 162c1ae57c84e118997f3577700b7adf19b6d3fd
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-11-20 09:00:48 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-11-23 17:17:11 +0000
pf: fix double free on error
If we fail to allocate dst->scrub in pf_normalize_sctp_init() we freed
src->scrub, but did not reset its pointer to NULL. As a result the
subsequent pf_kstate cleanup would try to free src->scrub a second time.
Reported by: llm-postcr
Fixes: e53632189f09 ("pf: fix sctp normalisation cleanup")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pf_norm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index baad40d44c8a..2a2355ab2756 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -1612,6 +1612,7 @@ pf_normalize_sctp_init(struct pf_pdesc *pd, struct pf_state_peer *src,
dst->scrub = uma_zalloc(V_pf_state_scrub_z, M_ZERO | M_NOWAIT);
if (dst->scrub == NULL) {
uma_zfree(V_pf_state_scrub_z, src->scrub);
+ src->scrub = NULL;
return (1);
}