git: c91539772b07 - main - pflow: Destroy exporters on module unload
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Oct 2026 20:26:15 UTC
The branch main has been updated by rcm:
URL: https://cgit.FreeBSD.org/src/commit/?id=c91539772b07cb78369626716a4ddf92cf6caa5f
commit c91539772b07cb78369626716a4ddf92cf6caa5f
Author: R. Christian McDonald <rcm@FreeBSD.org>
AuthorDate: 2026-10-19 20:18:25 +0000
Commit: R. Christian McDonald <rcm@FreeBSD.org>
CommitDate: 2026-10-19 20:25:40 +0000
pflow: Destroy exporters on module unload
Since 83641335f96c only jail removal destroys exporters. Unloading
pflow with one left trips the assertion in vnet_pflowdetach() or,
without INVARIANTS, leaves pf calling into the freed module the next
time it removes a state that pflow exports.
Reviewed by: kp
Fixes: 83641335f96c ("pf: clean up pflow sockets on jail removal")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pflow.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sys/netpfil/pf/pflow.c b/sys/netpfil/pf/pflow.c
index d30b80c88d89..7b9fa5bc7249 100644
--- a/sys/netpfil/pf/pflow.c
+++ b/sys/netpfil/pf/pflow.c
@@ -205,8 +205,12 @@ pflow_jail_remove(void *obj, void *data __unused)
static void
vnet_pflowdetach(void)
{
+ struct pflow_softc *sc, *tmp;
+
+ /* Left on module unload; drain before the counters are freed. */
+ CK_LIST_FOREACH_SAFE(sc, &V_pflowif_list, sc_next, tmp)
+ pflow_destroy(sc->sc_id, true);
- /* Should have been done by pflow_jail_remove() */
MPASS(CK_LIST_EMPTY(&V_pflowif_list));
delete_unrhdr(V_pflow_unr);
mtx_destroy(&V_pflowif_list_mtx);