[B.A.T.M.A.N.] [PATCH 08/15] batman-adv: prevent potential hlist double deletion

Antonio Quartulli antonio at meshcoding.com
Tue Aug 25 13:02:32 CEST 2015

From: Marek Lindner <mareklindner at neomailbox.ch>

The hlist_del_rcu() call in batadv_tt_global_size_mod() does not check
if the element still is part of the list prior to deletion. The atomic
list counter should prevent the worst but converting to
hlist_del_init_rcu() ensures the element can't be deleted more than

Signed-off-by: Marek Lindner <mareklindner at neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio at meshcoding.com>
 net/batman-adv/translation-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 9e1f866..596e326 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -315,7 +315,7 @@ static void batadv_tt_global_size_mod(struct batadv_orig_node *orig_node,
 	if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
-		hlist_del_rcu(&vlan->list);
+		hlist_del_init_rcu(&vlan->list);

More information about the B.A.T.M.A.N mailing list