git: ba70b704053f - main - pf: include orig_kif in the mark-and-sweep cleanup mechanism
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Nov 2026 12:53:35 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=ba70b704053f4a36514344a2cb7003ad11e06c60
commit ba70b704053f4a36514344a2cb7003ad11e06c60
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-11-24 08:40:44 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-11-24 10:48:34 +0000
pf: include orig_kif in the mark-and-sweep cleanup mechanism
As part of the purge process we mark all kifs referenced by states, so
that at the end of the sweep we know which ones are no longer referenced
and can be safely cleaned up.
We forgot to mark the orig_kif, so it was possible for a kif to be
referenced only by a state's orig_kif field, and if the interface itself
then went away we might end up freeing the kif while a state still
referenced it.
Reported by: llm-postcr
Fixes: d0fdf2b28f9b ("pf: Track the original kif for floating states")
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 77a3eb643eeb..9def49c6052c 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -3252,6 +3252,8 @@ relock:
mrm->r->rule_ref |= PFRULE_REFS;
if (s->act.rt_kif)
pf_kkif_mark(s->act.rt_kif);
+ if (s->orig_kif)
+ pf_kkif_mark(s->orig_kif);
count++;
}
PF_HASHROW_UNLOCK(ih);