Subject: Re: [PATCH net-next-2.6 8/9] jme: Don't show UDP Checksum error if HW misjudged

From: "Guo-Fu Tseng" <[email-masked]>
Date: Mon, 14 Feb 2011 13:13:01 +0800

On Sun, 13 Feb 2011 20:43:00 -0800 (PST), David Miller wrote
> From: "Guo-Fu Tseng" <[email-masked]>
> Date: Mon, 14 Feb 2011 12:27:41 +0800
> 
> > @@ -956,8 +956,27 @@ jme_disable_rx_engine(struct jme_adapter *jme)
> >  	jme_mac_rxclk_off(jme);
> >  }
> >  
> > +static u16
> > +jme_udpsum(struct sk_buff *skb)
> > +{
> > +	u16 csum = 0xFFFFu;
> > +
> > +	if (skb->protocol != htons(ETH_P_IP))
> > +		return csum;
> > +	skb_set_network_header(skb, ETH_HLEN);
> > +	if (ip_hdr(skb)->protocol != IPPROTO_UDP)
> > +		return csum;
> > +	skb_set_transport_header(skb,
> > +			ETH_HLEN + (ip_hdr(skb)->ihl << 2));
> > +	csum = udp_hdr(skb)->check;
> > +	skb_reset_transport_header(skb);
> > +	skb_reset_network_header(skb);
> > +
> > +	return csum;
> > +}
> 
> You need to validate the packet length in all of these packet header
> accesses, otherwise you're potentially looking at garbage.
Thank you!
Redoing this path, I'll send it later. :)

Guo-Fu Tseng