2 struct tt_global_entry holds a reference to an orig_node which must be
3 decremented before deallocating the structure.
5 Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
9 translation-table.c | 14 +++++++++++++-
10 3 files changed, 13 insertions(+), 10 deletions(-)
14 @@ -36,12 +36,4 @@ void free_rcu_tt_local_entry(struct rcu_head *rcu)
15 kfree(tt_local_entry);
18 -void free_rcu_tt_global_entry(struct rcu_head *rcu)
20 - struct tt_global_entry *tt_global_entry;
22 - tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
23 - kfree(tt_global_entry);
26 #endif /* < KERNEL_VERSION(3, 0, 0) */
29 @@ -63,7 +63,6 @@ void free_rcu_gw_node(struct rcu_head *rcu);
30 void free_rcu_neigh_node(struct rcu_head *rcu);
31 void free_rcu_softif_neigh(struct rcu_head *rcu);
32 void free_rcu_tt_local_entry(struct rcu_head *rcu);
33 -void free_rcu_tt_global_entry(struct rcu_head *rcu);
35 #endif /* < KERNEL_VERSION(3, 0, 0) */
37 --- a/translation-table.c
38 +++ b/translation-table.c
39 @@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
40 kfree_rcu(tt_local_entry, rcu);
43 +static void tt_global_entry_free_rcu(struct rcu_head *rcu)
45 + struct tt_global_entry *tt_global_entry;
47 + tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
49 + if (tt_global_entry->orig_node)
50 + orig_node_free_ref(tt_global_entry->orig_node);
52 + kfree(tt_global_entry);
55 static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
57 if (atomic_dec_and_test(&tt_global_entry->refcount))
58 - kfree_rcu(tt_global_entry, rcu);
59 + call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
62 static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,