]> git.baikalelectronics.ru Git - kernel.git/commit
batman-adv: avoid NULL dereferences and fix if check
authorAntonio Quartulli <antonio@meshcoding.com>
Sat, 20 Dec 2014 12:48:57 +0000 (13:48 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Dec 2014 04:13:37 +0000 (23:13 -0500)
commite56362ef08c5114b996846227c24ce9817aa454e
tree98dd759ca950e3d8220ff7504baba8c4bec7b7da
parentc40dd5a8739226a2fb3ac846d3c7757a2c7c07ef
batman-adv: avoid NULL dereferences and fix if check

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 b68c1757f022be7b276e3511870c3af723a12a39
("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>
net/batman-adv/gateway_client.c