Skip to content

Commit

Permalink
batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible
Browse files Browse the repository at this point in the history
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: 50164d8 ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic")
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Acked-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
  • Loading branch information
Sven Eckelmann authored and Simon Wunderlich committed Dec 1, 2017
1 parent fe77d82 commit 198a62d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/batman-adv/bat_v.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 198a62d

Please sign in to comment.