[Bug 268246] crash and panic using pfsync on 13.1-RELEASE

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 28 Jan 2023 02:35:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268246

--- Comment #42 from Kristof Provost <kp@freebsd.org> ---
(In reply to jjasen from comment #39)
Let's be a bit less subtle then:

diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index 61308a35a7e1..d0bc699e4d29 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -1734,6 +1738,7 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m)
        struct pfsync_softc *sc = V_pfsyncif;
        struct pfsync_deferral *pd;
        struct pfsync_bucket *b;
+    struct ip *ip;

        if (m->m_flags & (M_BCAST|M_MCAST))
                return (0);
@@ -1751,6 +1756,13 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m)
                return (0);
        }

+    ip = mtod(m, struct ip *);
+    if (ip->ip_v == 4) {
+        int len = ntohs(ip->ip_len);
+        if (m_length(m, NULL) != len)
+            panic("Incorrect ip_len %d != m_length %d", len, m_length(m,
NULL));
+    }
+
        PFSYNC_BUCKET_LOCK(b);
        PFSYNC_UNLOCK(sc);

If that panics we should have a pretty good idea of how we can end up in that
situation. If it doesn't we have another mystery.

-- 
You are receiving this mail because:
You are the assignee for the bug.