aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/gateway_client.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 2acd7a666bda..af128eff2edf 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -127,7 +127,7 @@ void gw_election(struct bat_priv *bat_priv)
127 return; 127 return;
128 128
129 curr_gw = gw_get_selected_gw_node(bat_priv); 129 curr_gw = gw_get_selected_gw_node(bat_priv);
130 if (!curr_gw) 130 if (curr_gw)
131 goto out; 131 goto out;
132 132
133 rcu_read_lock(); 133 rcu_read_lock();
@@ -310,9 +310,13 @@ void gw_node_update(struct bat_priv *bat_priv,
310 struct hlist_node *node; 310 struct hlist_node *node;
311 struct gw_node *gw_node, *curr_gw; 311 struct gw_node *gw_node, *curr_gw;
312 312
313 /**
314 * Note: We don't need a NULL check here, since curr_gw never gets
315 * dereferenced. If curr_gw is NULL we also should not exit as we may
316 * have this gateway in our list (duplication check!) even though we
317 * have no currently selected gateway.
318 */
313 curr_gw = gw_get_selected_gw_node(bat_priv); 319 curr_gw = gw_get_selected_gw_node(bat_priv);
314 if (!curr_gw)
315 goto out;
316 320
317 rcu_read_lock(); 321 rcu_read_lock();
318 hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { 322 hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) {
@@ -350,7 +354,7 @@ deselect:
350 gw_deselect(bat_priv); 354 gw_deselect(bat_priv);
351unlock: 355unlock:
352 rcu_read_unlock(); 356 rcu_read_unlock();
353out: 357
354 if (curr_gw) 358 if (curr_gw)
355 gw_node_free_ref(curr_gw); 359 gw_node_free_ref(curr_gw);
356} 360}