batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible
authorSven Eckelmann <sven.eckelmann@openmesh.com>
Mon, 16 Mar 2020 22:30:51 +0000 (23:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Mar 2020 08:07:53 +0000 (09:07 +0100)
commit8c69c09f5ede7b40f0d5bc1c12d4880bdc30d9d9
treebe0df5a378aae873cf02e50a36a50b3b2ca55ee9
parentea40bc532c52ae43a7eaed389f04551a5d318ad4
batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible

commit 198a62ddffa4a4ffaeb741f642b7b52f2d91ae9b upstream.

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: 50164d8f500f ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/bat_v.c