summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/gateway_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r--net/batman-adv/gateway_client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 41eba8a660f..3cc43558cf9 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -53,9 +53,11 @@ void *gw_get_selected(struct bat_priv *bat_priv)
goto out;
orig_node = curr_gateway_tmp->orig_node;
+ if (!orig_node)
+ goto out;
- if (orig_node)
- kref_get(&orig_node->refcount);
+ if (!atomic_inc_not_zero(&orig_node->refcount))
+ orig_node = NULL;
out:
rcu_read_unlock();