The following commit has been merged in the maint branch: commit ee9f128534108be4eafd2ecb410ea89e1f063e8b Author: Simon Wunderlich simon.wunderlich@s2003.tu-chemnitz.de Date: Wed Oct 19 11:02:25 2011 +0200
batman-adv: remove references for global tt entries
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
diff --git a/compat.c b/compat.c index 88ceb40..1793904 100644 --- a/compat.c +++ b/compat.c @@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu) kfree(tt_local_entry); }
-void free_rcu_tt_global_entry(struct rcu_head *rcu) -{ - struct tt_global_entry *tt_global_entry; - - tt_global_entry = container_of(rcu, struct tt_global_entry, rcu); - kfree(tt_global_entry); -} - #endif /* < KERNEL_VERSION(3, 0, 0) */ diff --git a/compat.h b/compat.h index 829b0fb..aad9310 100644 --- a/compat.h +++ b/compat.h @@ -61,7 +61,6 @@ void free_rcu_gw_node(struct rcu_head *rcu); void free_rcu_neigh_node(struct rcu_head *rcu); void free_rcu_softif_neigh(struct rcu_head *rcu); void free_rcu_tt_local_entry(struct rcu_head *rcu); -void free_rcu_tt_global_entry(struct rcu_head *rcu);
#endif /* < KERNEL_VERSION(3, 0, 0) */
diff --git a/translation-table.c b/translation-table.c index ef1acfd..ca537ed 100644 --- a/translation-table.c +++ b/translation-table.c @@ -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,