1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Sun, 29 May 2016 21:25:52 +0200
3 Subject: [PATCH] batman-adv: Fix ICMP RR ethernet access after skb_linearize
5 The skb_linearize may reallocate the skb. This makes the calculated pointer
6 for ethhdr invalid. But it the pointer is used later to fill in the RR
7 field of the batadv_icmp_packet_rr packet.
9 Instead re-evaluate eth_hdr after the skb_linearize+skb_cow to fix the
10 pointer and avoid the invalid read.
12 Fixes: bb69cb678d37 ("batman-adv: generalize batman-adv icmp packet handling")
13 Signed-off-by: Sven Eckelmann <sven@narfation.org>
15 Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/f6c80c29ef4e8b45b715976107b7ae06fc0be3a0
17 net/batman-adv/routing.c | 1 +
18 1 file changed, 1 insertion(+)
20 diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
21 index 0c0c30e..27e07dd 100644
22 --- a/net/batman-adv/routing.c
23 +++ b/net/batman-adv/routing.c
24 @@ -374,6 +374,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
25 if (skb_cow(skb, ETH_HLEN) < 0)
28 + ethhdr = eth_hdr(skb);
29 icmph = (struct batadv_icmp_header *)skb->data;
30 icmp_packet_rr = (struct batadv_icmp_packet_rr *)icmph;
31 if (icmp_packet_rr->rr_cur >= BATADV_RR_LEN)