Author: marek Date: 2010-01-10 04:56:03 +0100 (Sun, 10 Jan 2010) New Revision: 1547
Modified: trunk/batman-adv-kernelland/gateway_client.c Log: batman-adv: avoid crash when handling with stale current best gw
The current best gw pointer may point to a non-existant orig node which may lead to a crash if the memory is accessed without checking.
Signed-off-by: Marek Lindner lindner_marek@yahoo.de
Modified: trunk/batman-adv-kernelland/gateway_client.c =================================================================== --- trunk/batman-adv-kernelland/gateway_client.c 2010-01-10 03:55:59 UTC (rev 1546) +++ trunk/batman-adv-kernelland/gateway_client.c 2010-01-10 03:56:03 UTC (rev 1547) @@ -162,6 +162,12 @@ if (!curr_gateway_tmp) return;
+ if (!curr_gateway_tmp->orig_node) + goto deselect; + + if (!curr_gateway_tmp->orig_node->router) + goto deselect; + /* this node already is the gateway */ if (curr_gateway_tmp->orig_node == orig_node) return; @@ -188,6 +194,7 @@ "Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i) \n", gw_tq_avg, orig_tq_avg);
+deselect: gw_deselect(); }