Date: Mon, 22 Jan 2007 15:20:38 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113322 for review Message-ID: <200701221520.l0MFKcvo004412@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113322 Change 113322 by millert@millert_macbook on 2007/01/22 15:19:53 Use m_dup_pkthdr() instead of M_COPY_PKTHDR() in m_copym() and m_copym_with_hdrs() since with MAC, M_COPY_PKTHDR() moves the mbuf tags instead of copying them, which effectively leaves the source mbuf unlabeled. Also need to zero out m_pkthdr.aux in the source mbuf after m_dup_pkthdr(). m_copy_pkthdr() did this for us but m_dup_pkthdr() does not. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_mbuf.c#6 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_mbuf.c#6 (text+ko) ==== @@ -1536,7 +1536,11 @@ if (n == 0) goto nospace; if (copyhdr) { - M_COPY_PKTHDR(n, m); + MBUF_UNLOCK(); + if (!m_dup_pkthdr(n, m, wait)) + goto nospace_unlock; + MBUF_LOCK(); + m->m_pkthdr.aux = (struct mbuf *)NULL; if (len == M_COPYALL) n->m_pkthdr.len -= off0; else @@ -1579,6 +1583,7 @@ nospace: MBUF_UNLOCK(); +nospace_unlock: m_freem(top); MCFail++; return (0); @@ -1677,7 +1682,11 @@ *np = n; if (copyhdr) { - M_COPY_PKTHDR(n, m); + MBUF_UNLOCK(); + if (!m_dup_pkthdr(n, m, wait)) + goto nospace_unlock; + MBUF_LOCK(); + m->m_pkthdr.aux = (struct mbuf *)NULL; n->m_pkthdr.len = len; copyhdr = 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701221520.l0MFKcvo004412>