git: 93a955fcc313 - main - pf: fix incorrect list use in pflow_jail_remove()

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 08 May 2025 13:10:43 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=93a955fcc3137772c06195a19e5a1d85982fec27

commit 93a955fcc3137772c06195a19e5a1d85982fec27
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-05-06 15:36:03 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-05-08 13:10:25 +0000

    pf: fix incorrect list use in pflow_jail_remove()
    
    We remove items from V_pflowif_list while iterating it (via pflow_destroy()), so
    we must use the _SAFE macro.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netpfil/pf/pflow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netpfil/pf/pflow.c b/sys/netpfil/pf/pflow.c
index 00890589814d..d30b80c88d89 100644
--- a/sys/netpfil/pf/pflow.c
+++ b/sys/netpfil/pf/pflow.c
@@ -191,10 +191,10 @@ pflow_jail_remove(void *obj, void *data __unused)
 #ifdef VIMAGE
 	const struct prison *pr = obj;
 #endif
-	struct pflow_softc	*sc;
+	struct pflow_softc	*sc, *tmp;
 
 	CURVNET_SET(pr->pr_vnet);
-	CK_LIST_FOREACH(sc, &V_pflowif_list, sc_next) {
+	CK_LIST_FOREACH_SAFE(sc, &V_pflowif_list, sc_next, tmp) {
 		pflow_destroy(sc->sc_id, false);
 	}
 	CURVNET_RESTORE();