* [B.A.T.M.A.N.] [PATCH-maint] batman-adv: Fix ICMP RR ethernet access after skb_linearize
@ 2016-05-29 19:25 Sven Eckelmann
2016-06-06 15:35 ` Marek Lindner
0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2016-05-29 19:25 UTC (permalink / raw)
To: b.a.t.m.a.n
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: bb69cb678d37 ("batman-adv: generalize batman-adv icmp packet handling")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
net/batman-adv/routing.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 0c0c30e..27e07dd 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -374,6 +374,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)
--
2.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-06 15:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-29 19:25 [B.A.T.M.A.N.] [PATCH-maint] batman-adv: Fix ICMP RR ethernet access after skb_linearize Sven Eckelmann
2016-06-06 15:35 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox