Skip to content

Commit a67fa81

Browse files
ordexgregkh
authored andcommitted
batman-adv: avoid NULL dereferences and fix if check
[ Upstream commit 0d16449 ] Gateway having bandwidth_down equal to zero are not accepted at all and so never added to the Gateway list. For this reason checking the bandwidth_down member in batadv_gw_out_of_range() is useless. This is probably a copy/paste error and this check was supposed to be "!gw_node" only. Moreover, the way the check is written now may also lead to a NULL dereference. Fix this by rewriting the if-condition properly. Introduced by 414254e ("batman-adv: tvlv - gateway download/upload bandwidth container") Signed-off-by: Antonio Quartulli <antonio@meshcoding.com> Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4a4867f commit a67fa81

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/batman-adv/gateway_client.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
810810
goto out;
811811

812812
gw_node = batadv_gw_node_get(bat_priv, orig_dst_node);
813-
if (!gw_node->bandwidth_down == 0)
813+
if (!gw_node)
814814
goto out;
815815

816816
switch (atomic_read(&bat_priv->gw_mode)) {

0 commit comments

Comments
 (0)