Netdev List
 help / color / mirror / Atom feed
* [BUG] eth_type_trans() can access stale data
@ 2014-01-14 23:52 Eric Dumazet
  2014-01-15  0:21 ` Ben Hutchings
  2014-01-15 23:48 ` [BUG] eth_type_trans() can access stale data David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Dumazet @ 2014-01-14 23:52 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Following code :

if (unlikely(skb->len >= 2 && *(unsigned short *)(skb->data) == 0xFFFF))
	return htons(ETH_P_802_3);

expects the additional bytes are in skb->head

I do not think all eth_type_trans() are ready for a pskb_may_pull()
(I am too lazy to perform a whole check)

Would following workaround be OK ?

diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 8f032bae60ad..d95403098f09 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -194,7 +194,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	 *      layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
 	 *      won't work for fault tolerant netware but does for the rest.
 	 */
-	if (unlikely(skb->len >= 2 && *(unsigned short *)(skb->data) == 0xFFFF))
+	if (unlikely(skb_headlen(skb) >= 2 &&
+		     *(unsigned short *)(skb->data) == 0xFFFF))
 		return htons(ETH_P_802_3);
 
 	/*

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-16 23:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 23:52 [BUG] eth_type_trans() can access stale data Eric Dumazet
2014-01-15  0:21 ` Ben Hutchings
2014-01-16 23:03   ` [PATCH net-next] net: eth_type_trans() should use skb_header_pointer() Eric Dumazet
2014-01-16 23:30     ` David Miller
2014-01-15 23:48 ` [BUG] eth_type_trans() can access stale data David Miller
2014-01-16 20:15   ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox