Skip to content

Commit

Permalink
batman-adv: remove references for global tt entries
Browse files Browse the repository at this point in the history
commit 531027f 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>
  • Loading branch information
Simon Wunderlich authored and Greg Kroah-Hartman committed Nov 26, 2011
1 parent 02460fc commit 7766f4e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion net/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7766f4e

Please sign in to comment.