From b4df2af26ad1a61241ed347f4b09f9f5159434d4 Mon Sep 17 00:00:00 2001 From: jfv Date: Tue, 25 Jan 2011 23:20:22 +0000 Subject: [PATCH] MFC stable/8 r217711 Fix for kern/152853, pullup in the wrong place in em_xmit causes UDP failure. Thanks to Petr Lampa for the patch. Approved by: re (bz) git-svn-id: svn://svn.freebsd.org/base/releng/8.2@217865 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/e1000/if_em.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 103f66a0..e004cc7b 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1820,12 +1820,12 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp) } ip = (struct ip *)(mtod(m_head, char *) + ip_off); poff = ip_off + (ip->ip_hl << 2); - m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); - if (m_head == NULL) { - *m_headp = NULL; - return (ENOBUFS); - } if (do_tso) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } tp = (struct tcphdr *)(mtod(m_head, char *) + poff); /* * TSO workaround: @@ -1849,6 +1849,11 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp) tp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP)); } else if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { + m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); + if (m_head == NULL) { + *m_headp = NULL; + return (ENOBUFS); + } tp = (struct tcphdr *)(mtod(m_head, char *) + poff); m_head = m_pullup(m_head, poff + (tp->th_off << 2)); if (m_head == NULL) { -- 2.42.0