From 68b64bbc01ed0179cc7da0c2568c0920ced45cbc Mon Sep 17 00:00:00 2001 From: Andrew Gallatin Date: Tue, 13 Oct 2026 09:01:26 -0400 Subject: [PATCH] pfil: Avoid potential mbuf tag leak In '398254f9999e mbuf: simplify m_free' we removed tag processing on m_free() of M_NOFREE mbufs. It is possible that a packet filter could attach a tag to this stack mbuf and call m_free() on it, meaning that 398254f9999e may have introduced a tag leak. However,if a tag is attached without anyone calling m_free(), then this leak was pre-existing. Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D60686 Fixes: 398254f9999e Sponsored by: Netflix (cherry picked from commit f4ff995e361fa72cea240c4dbac2d0931965c80f) --- sys/net/pfil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/pfil.c b/sys/net/pfil.c index fae150839eb..400ea4d97fb 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -139,6 +139,8 @@ pfil_fake_mbuf(pfil_mbuf_chk_t func, void *mem, u_int len, struct ifnet *ifp, */ rv = PFIL_REALLOCED; } + if (!SLIST_EMPTY(&m.m_pkthdr.tags)) + m_tag_delete_chain(&m, NULL); return (rv); }