Skip to contentSkip to conversation

batman-adv: Fix invalid stack access in batadv_dat_select_candidates

PATCH Applied Sven Eckelmann 2 participants 2 messages Nov 3, 2015 – Nov 17, 2015 Batman advanced

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 batman-adv: Fix invalid stack access in batadv_dat_select_candidates

batadv_dat_select_candidates provides an u32 to batadv_hash_dat but it needs a batadv_dat_entry with at least ip and vid filled in.

Fixes 3e26722bc9f2 ("batman-adv: make the Distributed ARP Table vlan aware")

---
v2: Send with @open-mesh.com address for correct sponsor attribution

 net/batman-adv/distributed-arp-table.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +4 -1
index 7d75e67..79b9993 100644
@@ -566,6 +566,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
 	int select;
 	batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key;
 	struct batadv_dat_candidate *res;
+	struct batadv_dat_entry dat;
 
 	if (!bat_priv->orig_hash)
 		return NULL;
@@ -575,7 +576,9 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
 	if (!res)
 		return NULL;
 
-	ip_key = (batadv_dat_addr_t)batadv_hash_dat(&ip_dst,
+	dat.ip = ip_dst;
+	dat.vid = 0;
+	ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat,
 						    BATADV_DAT_ADDR_MAX);
 
 	batadv_dbg(BATADV_DBG_DAT, bat_priv,
Signature · 1 line
2.6.2
#1 lore raw
Quoted 11 lines · On Tuesday, November 03, 2015 10:05:44 Sven Eckelmann wrote:

batadv_dat_select_candidates provides an u32 to batadv_hash_dat but it needs a batadv_dat_entry with at least ip and vid filled in.

Fixes 3e26722bc9f2 ("batman-adv: make the Distributed ARP Table vlan

aware") Signed-off-by: Sven Eckelmann <[email protected]>

---
v2: Send with @open-mesh.com address for correct sponsor attribution

 net/batman-adv/distributed-arp-table.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Applied in revision e897e5e.

Thanks,
Marek