Commit 0180a021 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Ben Hutchings

batman-adv: Free last_bonding_candidate on release of orig_node

commit cbef1e10 upstream.

The orig_ifinfo reference counter for last_bonding_candidate in
batadv_orig_node has to be reduced when an originator node is released.
Otherwise the orig_ifinfo is leaked and the reference counter the netdevice
is not reduced correctly.

Fixes: f3b3d901 ("batman-adv: add bonding again")
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16:
 - s/_put/_free_ref/
 - Adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 4d9b7b3a
......@@ -530,6 +530,7 @@ static void batadv_orig_node_release(struct batadv_orig_node *orig_node)
struct batadv_neigh_node *neigh_node;
struct batadv_orig_ifinfo *orig_ifinfo;
struct batadv_orig_node_vlan *vlan, *vlan_tmp;
struct batadv_orig_ifinfo *last_candidate;
spin_lock_bh(&orig_node->neigh_list_lock);
......@@ -545,8 +546,14 @@ static void batadv_orig_node_release(struct batadv_orig_node *orig_node)
hlist_del_rcu(&orig_ifinfo->list);
batadv_orig_ifinfo_free_ref(orig_ifinfo);
}
last_candidate = orig_node->last_bonding_candidate;
orig_node->last_bonding_candidate = NULL;
spin_unlock_bh(&orig_node->neigh_list_lock);
if (last_candidate)
batadv_orig_ifinfo_free_ref(last_candidate);
spin_lock_bh(&orig_node->vlan_list_lock);
list_for_each_entry_safe(vlan, vlan_tmp, &orig_node->vlan_list, list) {
list_del_rcu(&vlan->list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment