git: 57f9bad9188d - main - pf: deregister the ifnet_rename_event handler on unload
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 29 Sep 2026 19:19:39 UTC
The branch main has been updated by rcm:
URL: https://cgit.FreeBSD.org/src/commit/?id=57f9bad9188d70272c131a6cc8502d00be58fd56
commit 57f9bad9188d70272c131a6cc8502d00be58fd56
Author: R. Christian McDonald <rcm@FreeBSD.org>
AuthorDate: 2026-09-29 18:27:36 +0000
Commit: R. Christian McDonald <rcm@FreeBSD.org>
CommitDate: 2026-09-29 19:19:19 +0000
pf: deregister the ifnet_rename_event handler on unload
pfi_initialize() registers pfi_rename_ifnet_event() on
ifnet_rename_event, but pfi_cleanup() never deregisters it. After
"kldunload pf", the next interface rename calls through a stale
pointer into the unloaded module:
kldload pf
kldunload pf
ifconfig epair create
ifconfig epair0a name foo
Reviewed by: kp
Approved by: kp (mentor)
Fixes: 349fcf079ca3 ("net: add ifnet_rename_event EVENTHANDLER(9) for interface renaming")
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pf_if.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c
index 3993a3ee4c13..aed1af15fb30 100644
--- a/sys/netpfil/pf/pf_if.c
+++ b/sys/netpfil/pf/pf_if.c
@@ -221,6 +221,7 @@ pfi_cleanup(void)
EVENTHANDLER_DEREGISTER(ifnet_arrival_event, pfi_attach_cookie);
EVENTHANDLER_DEREGISTER(ifnet_departure_event, pfi_detach_cookie);
+ EVENTHANDLER_DEREGISTER(ifnet_rename_event, pfi_rename_cookie);
EVENTHANDLER_DEREGISTER(group_attach_event, pfi_attach_group_cookie);
EVENTHANDLER_DEREGISTER(group_change_event, pfi_change_group_cookie);
EVENTHANDLER_DEREGISTER(group_detach_event, pfi_detach_group_cookie);