Commit a121048a89f8186fa2c8388d5b41528466013857

Authored by Marek Lindner
Committed by Antonio Quartulli
1 parent d0fa4f3f5b

batman-adv: prevent potential hlist double deletion

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
once.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

net/batman-adv/translation-table.c
... ... @@ -315,7 +315,7 @@
315 315  
316 316 if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
317 317 spin_lock_bh(&orig_node->vlan_list_lock);
318   - hlist_del_rcu(&vlan->list);
  318 + hlist_del_init_rcu(&vlan->list);
319 319 spin_unlock_bh(&orig_node->vlan_list_lock);
320 320 batadv_orig_node_vlan_free_ref(vlan);
321 321 }