Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Feb 2009 02:00:43 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r188361 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/msk
Message-ID:  <200902090200.n1920h4o041404@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Mon Feb  9 02:00:43 2009
New Revision: 188361
URL: http://svn.freebsd.org/changeset/base/188361

Log:
  MFC r183485-183486
   r183485:
    Always pullup mbuf prior to accessing TCP header.
    This should fix occasional Tx checksum corruption issue.
  
   r183486:
    If mbuf is not writable get a writable copy before invoking
    m_pullup(9).

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/msk/if_msk.c

Modified: stable/7/sys/dev/msk/if_msk.c
==============================================================================
--- stable/7/sys/dev/msk/if_msk.c	Mon Feb  9 01:55:30 2009	(r188360)
+++ stable/7/sys/dev/msk/if_msk.c	Mon Feb  9 02:00:43 2009	(r188361)
@@ -2559,7 +2559,16 @@ msk_encap(struct msk_if_softc *sc_if, st
 		struct ip *ip;
 		struct tcphdr *tcp;
 
-		/* TODO check for M_WRITABLE(m) */
+		if (M_WRITABLE(m) == 0) {
+			/* Get a writable copy. */
+			m = m_dup(*m_head, M_DONTWAIT);
+			m_freem(*m_head);
+			if (m == NULL) {
+				*m_head = NULL;
+				return (ENOBUFS);
+			}
+			*m_head = m;
+		}
 
 		offset = sizeof(struct ether_header);
 		m = m_pullup(m, offset);
@@ -2601,6 +2610,11 @@ msk_encap(struct msk_if_softc *sc_if, st
 		    (m->m_pkthdr.csum_flags & CSUM_TCP) != 0) {
 			uint16_t csum;
 
+			m = m_pullup(m, offset + sizeof(struct tcphdr));
+			if (m == NULL) {
+				*m_head = NULL;
+				return (ENOBUFS);
+			}
 			csum = in_cksum_skip(m, ntohs(ip->ip_len) + offset -
 			    (ip->ip_hl << 2), offset);
 			*(uint16_t *)(m->m_data + offset +



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902090200.n1920h4o041404>