diff options
| author | Kristof Provost <kp@FreeBSD.org> | 2022-08-19 10:01:58 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2022-08-19 12:53:09 +0000 |
| commit | c780d3ad7bcbf3cc181b50a4e09b8ab18b8bd3c6 (patch) | |
| tree | 26984fcee099b8e094f6d96e6cd78bbd0eeabe85 | |
| parent | 319a4bddb0b991377208293283a87946e4b5d055 (diff) | |
pf: clear ethernet rules prior to shutdown
Ethernet rule cleanup is postponed to an epoch callback. Ensure it's
been called before we remove the entire vnet, or we risk the rules still
getting hit after we've freed the uma zone, i.e. a use-after-free.
Sponsored by: Rubicon Communications, LLC ("Netgate")
| -rw-r--r-- | sys/netpfil/pf/pf_ioctl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 696ae4d0de70..81f35ba1c98c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -6714,6 +6714,9 @@ pf_unload_vnet(void) shutdown_pf(); PF_RULES_WUNLOCK(); + /* Make sure we've cleaned up ethernet rules before we continue. */ + NET_EPOCH_DRAIN_CALLBACKS(); + ret = swi_remove(V_pf_swi_cookie); MPASS(ret == 0); ret = intr_event_destroy(V_pf_swi_ie); |
