[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110213.204300.186319004.davem@davemloft.net>
Date: Sun, 13 Feb 2011 20:43:00 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: cooldavid@...ldavid.org
Cc: netdev@...r.kernel.org, arieslee@...cron.com,
devinchiu@...cron.com, ethanhsiao@...cron.com
Subject: Re: [PATCH net-next-2.6 8/9] jme: Don't show UDP Checksum error if
HW misjudged
From: "Guo-Fu Tseng" <cooldavid@...ldavid.org>
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists