From e93660d9bfcd4d4c2032b3c5800ac7ab557e48f6 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Sun, 26 Aug 2012 23:25:59 +0200 Subject: [PATCH] --- yaml --- r: 340536 b: refs/heads/master c: b8fcfa42e4ec5d55d4cccd5c728415e8bca0539d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/net/batman-adv/routing.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index f342d731bd13..022a6113a67c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 60c39c7584e1bb69cdce4e0a9ee1e78ba09c82b9 +refs/heads/master: b8fcfa42e4ec5d55d4cccd5c728415e8bca0539d diff --git a/trunk/net/batman-adv/routing.c b/trunk/net/batman-adv/routing.c index 456a0a9f8831..46dd5b47ed29 100644 --- a/trunk/net/batman-adv/routing.c +++ b/trunk/net/batman-adv/routing.c @@ -908,8 +908,12 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, bool tt_poss_change; int is_old_ttvn; - /* I could need to modify it */ - if (skb_cow(skb, sizeof(struct batadv_unicast_packet)) < 0) + /* check if there is enough data before accessing it */ + if (pskb_may_pull(skb, sizeof(*unicast_packet) + ETH_HLEN) < 0) + return 0; + + /* create a copy of the skb (in case of for re-routing) to modify it. */ + if (skb_cow(skb, sizeof(*unicast_packet)) < 0) return 0; unicast_packet = (struct batadv_unicast_packet *)skb->data;