[lkml]   [2010]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] [192/223] Staging: batman-adv: ensure that eth_type_trans gets linear memory
2.6.35-longterm review patch.  If anyone has any objections, please let me know.

From: Marek Lindner <>

commit b6faaae1a15a352d68b3e3cd8b840e56709820bf upstream.

eth_type_trans tries to pull data with the length of the ethernet header
from the skb. We only ensured that enough data for the first ethernet
header and the batman header is available in non-paged memory of the skb
and not for the ethernet after the batman header.

eth_type_trans would fail sometimes with drivers which don't ensure that
all there data is perfectly linearised.

The failure was noticed through a kernel bug Oops generated by the
skb_pull inside eth_type_trans.

Reported-by: Rafal Lesniak <>
Signed-off-by: Marek Lindner <>
Signed-off-by: Sven Eckelmann <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: Andi Kleen <>

drivers/staging/batman-adv/soft-interface.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux/drivers/staging/batman-adv/soft-interface.c
--- linux.orig/drivers/staging/batman-adv/soft-interface.c
+++ linux/drivers/staging/batman-adv/soft-interface.c
@@ -295,6 +295,10 @@ void interface_rx(struct sk_buff *skb, i
skb_pull_rcsum(skb, hdr_size);
/* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/

+ if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) {
+ kfree_skb(skb);
+ return;
+ }
skb->dev = dev;
skb->protocol = eth_type_trans(skb, dev);

 \ /
  Last update: 2010-12-13 00:57    [W:0.550 / U:0.168 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site