Skip to content

Commit

Permalink
batman-adv: Modify neigh_list only with rcu-list functions
Browse files Browse the repository at this point in the history
The batadv_hard_iface::neigh_list is accessed via rcu based primitives.
Thus all operations done on it have to fulfill the requirements by RCU. So
using non-RCU mechanisms like hlist_add_head is not allowed because it
misses the barriers required to protect concurrent readers when accessing
the data behind the pointer.

Fixes: cef6341 ("batman-adv: add list of unique single hop neighbors per hard-interface")
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Acked-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
  • Loading branch information
Sven Eckelmann authored and Simon Wunderlich committed Oct 17, 2016
1 parent 29fbff8 commit 9ca488d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
if (bat_priv->algo_ops->neigh.hardif_init)
bat_priv->algo_ops->neigh.hardif_init(hardif_neigh);

hlist_add_head(&hardif_neigh->list, &hard_iface->neigh_list);
hlist_add_head_rcu(&hardif_neigh->list, &hard_iface->neigh_list);

out:
spin_unlock_bh(&hard_iface->neigh_list_lock);
Expand Down

0 comments on commit 9ca488d

Please sign in to comment.