From: Eric Dumazet Date: Wed, 25 Aug 2010 23:44:35 +0000 (+0000) Subject: l2tp: test for ethernet header in l2tp_eth_dev_recv() X-Git-Tag: upstream/snapshot3+hdmi~12792^2~154 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfc960a8eec023a170a80697fe65157cd4f44f81;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git l2tp: test for ethernet header in l2tp_eth_dev_recv() close https://bugzilla.kernel.org/show_bug.cgi?id=16529 Before calling dev_forward_skb(), we should make sure skb head contains at least an ethernet header, even if length included in upper layer said so. Use pskb_may_pull() to make sure this ethernet header is present in skb head. Reported-by: Thomas Heil Reported-by: Ian Campbell Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 58c6c4c..1ae6976 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c @@ -132,7 +132,7 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, printk("\n"); } - if (data_len < ETH_HLEN) + if (!pskb_may_pull(skb, sizeof(ETH_HLEN))) goto error; secpath_reset(skb);