Skip to contentSkip to conversation

batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible

PATCH Applied Sven Eckelmann 2 participants 3 messages Nov 29, 2017 – Dec 1, 2017 Batman advanced

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible

The batadv_v_gw_is_eligible function already assumes that orig_node is not NULL. But batadv_gw_node_get may have failed to find the originator. It must therefore be checked whether the batadv_gw_node_get failed and not whether orig_node is NULL to detect this error.

Fixes 80b2d47be2c7 ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic")

---
Cc: Antonio Quartulli <[email protected]>

---
 net/batman-adv/bat_v.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bat_v.c +1 -1
index 341ceab8338d829d14a48831bef805bb04af0a8f..e0e2bfcd6b3efd73f2567d23ce304951c9e2c3f0 100644
@@ -814,7 +814,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
 	}
 
 	orig_gw = batadv_gw_node_get(bat_priv, orig_node);
-	if (!orig_node)
+	if (!orig_gw)
 		goto out;
 
 	if (batadv_v_gw_throughput_get(orig_gw, &orig_throughput) < 0)
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Sven Eckelmann

The batadv_v_gw_is_eligible function already assumes that orig_node is not NULL. But batadv_gw_node_get may have failed to find the originator. It must therefore be checked whether the batadv_gw_node_get failed and not whether orig_node is NULL to detect this error.

Fixes 80b2d47be2c7 ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic")
Signature · 1 line
Antonio Quartulli
author Applied
#2 lore raw
In reply to Sven Eckelmann
Quoted 5 lines · On Mittwoch, 29. November 2017 10:50:42 CET Sven Eckelmann wrote:

The batadv_v_gw_is_eligible function already assumes that orig_node is not NULL. But batadv_gw_node_get may have failed to find the originator. It must therefore be checked whether the batadv_gw_node_get failed and not whether orig_node is NULL to detect this error.

Quoted 8 lines
Fixes 80b2d47be2c7 ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic")

---
Cc: Antonio Quartulli <[email protected]>

---
 net/batman-adv/bat_v.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied in c7380677d616 [1]

Kind regards,
Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/c7380677d6167f3798d3ea7a4f1a93663f3c7915