]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
batman-adv: remove references for global tt entries
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Wed, 19 Oct 2011 09:02:25 +0000 (11:02 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 26 Nov 2011 17:08:39 +0000 (09:08 -0800)
commit 531027fcddbcf81c9937dd04f08a7e8f11fd47d2 upstream.

struct tt_global_entry holds a reference to an orig_node which must be
decremented before deallocating the structure.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Tested-by: Alexey Fisher <bug-track@fisher-privat.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/batman-adv/translation-table.c

index ef1acfd7653c14dac92b5ee942c2a19728cae9e3..ca537ed2dd0a650b580df5470324c84ea5bc430b 100644 (file)
@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
                kfree_rcu(tt_local_entry, rcu);
 }
 
+static void tt_global_entry_free_rcu(struct rcu_head *rcu)
+{
+       struct tt_global_entry *tt_global_entry;
+
+       tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
+
+       if (tt_global_entry->orig_node)
+               orig_node_free_ref(tt_global_entry->orig_node);
+
+       kfree(tt_global_entry);
+}
+
 static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
 {
        if (atomic_dec_and_test(&tt_global_entry->refcount))
-               kfree_rcu(tt_global_entry, rcu);
+               call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
 }
 
 static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,