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 +
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to