git: 46c84f4e884c - main - pf: hold PF_RULES_RLOCK while copying out ethernet rules
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Nov 2026 18:11:53 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=46c84f4e884c3916eaba7c015359aca5840904b7
commit 46c84f4e884c3916eaba7c015359aca5840904b7
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-11-20 14:30:23 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-11-23 17:17:12 +0000
pf: hold PF_RULES_RLOCK while copying out ethernet rules
Code that removes ethernet rules (e.g. pf_rollback_eth()) did not do so
via NET_EPOCH_CALL(), so simply entering NET_EPOCH is insufficient to
ensure the rule does not go away. Hold the rules lock until we're dony
copying the rule to the nvlist.
Reported by: Kevin Day <kevin@your.org>
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pf_ioctl.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 41c6641647ad..f6baa248722c 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -4262,7 +4262,6 @@ DIOCGETETHRULES_error:
}
case DIOCGETETHRULE: {
- struct epoch_tracker et;
struct pfioc_nv *nv = (struct pfioc_nv *)addr;
nvlist_t *nvl = NULL;
void *nvlpacked = NULL;
@@ -4325,15 +4324,12 @@ DIOCGETETHRULES_error:
PF_RULES_RUNLOCK();
ERROUT(ENOENT);
}
- /* Make sure rule can't go away. */
- NET_EPOCH_ENTER(et);
- PF_RULES_RUNLOCK();
nvl = pf_keth_rule_to_nveth_rule(rule);
if (pf_keth_anchor_nvcopyout(rs, rule, nvl)) {
- NET_EPOCH_EXIT(et);
+ PF_RULES_RUNLOCK();
ERROUT(EBUSY);
}
- NET_EPOCH_EXIT(et);
+ PF_RULES_RUNLOCK();
if (nvl == NULL)
ERROUT(ENOMEM);