openwrt-routing/batman-adv/patches/0002-batman-adv-fix-potenti...

45 lines
1.4 KiB
Diff

From 41b38727749a94c1a65cf0f4be9bfe1cbaf0adeb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@web.de>
Date: Mon, 20 Jan 2014 11:06:44 +0100
Subject: [PATCH 02/13] batman-adv: fix potential kernel paging error for
unicast transmissions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's
data. If it does then our ethhdr pointer is not valid anymore in
batadv_send_skb_unicast(), resulting in a kernel paging error.
Fixing this by refetching the ethhdr pointer after the potential
reallocation.
Introduced by b46c60b9e1ee7a1909c542413a85875a750955d6
("batman-adv: improve unicast packet (re)routing")
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
send.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/send.c b/send.c
index b0a3d76..2035bd9 100644
--- a/send.c
+++ b/send.c
@@ -281,6 +281,10 @@ static int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
goto out;
}
+ /* skb->data might have been reallocated by
+ * batadv_send_skb_prepare_unicast{,_4addr}()
+ */
+ ethhdr = eth_hdr(skb);
unicast_packet = (struct batadv_unicast_packet *)skb->data;
/* inform the destination node that we are still missing a correct route
--
1.9.0.rc3