aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-08-26 17:25:59 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-10-29 04:42:45 -0400
commitb8fcfa42e4ec5d55d4cccd5c728415e8bca0539d (patch)
treee4ebbf1372f4841b98b05276550db37b38f0abf7 /net/batman-adv
parent60c39c7584e1bb69cdce4e0a9ee1e78ba09c82b9 (diff)
batman-adv: check for more space before accessing the skb
In batadv_check_unicast_ttvn() the code accesses both the unicast header and the Ethernet header in the payload. For this reason pskb_may_pull() must be invoked to check for the required space. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/routing.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 456a0a9f8831..46dd5b47ed29 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -908,8 +908,12 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
908 bool tt_poss_change; 908 bool tt_poss_change;
909 int is_old_ttvn; 909 int is_old_ttvn;
910 910
911 /* I could need to modify it */ 911 /* check if there is enough data before accessing it */
912 if (skb_cow(skb, sizeof(struct batadv_unicast_packet)) < 0) 912 if (pskb_may_pull(skb, sizeof(*unicast_packet) + ETH_HLEN) < 0)
913 return 0;
914
915 /* create a copy of the skb (in case of for re-routing) to modify it. */
916 if (skb_cow(skb, sizeof(*unicast_packet)) < 0)
913 return 0; 917 return 0;
914 918
915 unicast_packet = (struct batadv_unicast_packet *)skb->data; 919 unicast_packet = (struct batadv_unicast_packet *)skb->data;