diff options
author | Gary S. Robertson <gary.robertson@linaro.org> | 2014-07-16 17:57:27 -0500 |
---|---|---|
committer | Gary S. Robertson <gary.robertson@linaro.org> | 2014-07-16 17:57:27 -0500 |
commit | 5d8c39dfa92c11553a1091717407aeaddc3de603 (patch) | |
tree | 0df1e82ebdde6b9e3722fd16f9195be36a73c144 /net/batman-adv/gateway_client.c | |
parent | 0993b170ac452761d5b49bca4f7022f2f14c50bc (diff) | |
parent | c0cbbdebe91a944d653ca75670b77bbf57498150 (diff) |
Merge tag 'v3.14.12' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into linux-lng-v3.14.xlinux-lng-3.14.12-2014.07
This is the 3.14.12 stable release
Conflicts:
arch/arm/mm/proc-v7-3level.S
kernel/hrtimer.c
mm/hugetlb.c
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r-- | net/batman-adv/gateway_client.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 55cf2260d295..36b9ae61f5e8 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c @@ -42,8 +42,10 @@ static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node) { - if (atomic_dec_and_test(&gw_node->refcount)) + if (atomic_dec_and_test(&gw_node->refcount)) { + batadv_orig_node_free_ref(gw_node->orig_node); kfree_rcu(gw_node, rcu); + } } static struct batadv_gw_node * @@ -408,9 +410,14 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, if (gateway->bandwidth_down == 0) return; + if (!atomic_inc_not_zero(&orig_node->refcount)) + return; + gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC); - if (!gw_node) + if (!gw_node) { + batadv_orig_node_free_ref(orig_node); return; + } INIT_HLIST_NODE(&gw_node->list); gw_node->orig_node = orig_node; |