batman-adv: Ensure that eth_type_trans gets linear memory
Commit Message
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.
Reported-by: thorkill <lesniak@sra.uni-hannover.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
batman-adv/soft-interface.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
Comments
On Sunday 21 November 2010 15:33:01 Sven Eckelmann wrote:
> 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.
Ok, I went ahead and applied this patch in revision 1874 after some
discussion. No Intel user needs to suffer if we can avoid it. ;-)
Thanks,
Marek
@@ -494,6 +494,8 @@ void interface_rx(struct net_device *soft_iface,
}
/* skb->dev & skb->pkt_type are set here */
+ if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
+ goto dropped;
skb->protocol = eth_type_trans(skb, soft_iface);
/* should not be neccesary anymore as we use skb_pull_rcsum()