From af4b94562133edf0728e28f2a0ae95ebb8f3c2b5 Mon Sep 17 00:00:00 2001 From: np Date: Thu, 29 Aug 2013 08:07:35 +0000 Subject: Merge r254736 from user/np/cxl_tuning. Don't leak tags when M_NOFREE | M_PKTHDR mbufs are freed. Reviewed by: andre --- sys/sys/mbuf.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 7e8f427..930a322 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -646,18 +646,6 @@ m_getcl(int how, short type, int flags) return (uma_zalloc_arg(zone_pack, &args, how)); } -static __inline struct mbuf * -m_free(struct mbuf *m) -{ - struct mbuf *n = m->m_next; - - if (m->m_flags & M_EXT) - mb_free_ext(m); - else if ((m->m_flags & M_NOFREE) == 0) - uma_zfree(zone_mbuf, m); - return (n); -} - static __inline void m_clget(struct mbuf *m, int how) { @@ -1124,6 +1112,20 @@ m_tag_find(struct mbuf *m, int type, struct m_tag *start) m_tag_locate(m, MTAG_ABI_COMPAT, type, start)); } +static __inline struct mbuf * +m_free(struct mbuf *m) +{ + struct mbuf *n = m->m_next; + + if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) + m_tag_delete_chain(m, NULL); + if (m->m_flags & M_EXT) + mb_free_ext(m); + else if ((m->m_flags & M_NOFREE) == 0) + uma_zfree(zone_mbuf, m); + return (n); +} + static int inline rt_m_getfib(struct mbuf *m) { -- cgit v1.1