diff options
author | Sven Eckelmann <sven@narfation.org> | 2016-06-26 11:16:12 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2016-08-22 22:38:24 +0100 |
commit | 6d3ce108753be2babf15497b4d071d0f9773ceb1 (patch) | |
tree | fe720675c4615e062c1585db5b0907a3580bdaf1 /net | |
parent | 51e37ea199daca63f7d8cdde65985d65971e77b8 (diff) |
batman-adv: Fix ICMP RR ethernet access after skb_linearize
commit 3b55e4422087f9f7b241031d758a0c65584e4297 upstream.
The skb_linearize may reallocate the skb. This makes the calculated pointer
for ethhdr invalid. But it the pointer is used later to fill in the RR
field of the batadv_icmp_packet_rr packet.
Instead re-evaluate eth_hdr after the skb_linearize+skb_cow to fix the
pointer and avoid the invalid read.
Fixes: da6b8c20a5b8 ("batman-adv: generalize batman-adv icmp packet handling")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/routing.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 51993a9f686c..22bbdd082546 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -344,6 +344,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, if (skb_cow(skb, ETH_HLEN) < 0) goto out; + ethhdr = eth_hdr(skb); icmph = (struct batadv_icmp_header *)skb->data; icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmph; if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN) |