Skip to contentSkip to conversation

batman-adv: Modify neigh_list only with rcu-list functions

PATCH Applied Sven Eckelmann 3 participants 3 messages Sep 29, 2016 – Oct 18, 2016 Batman advanced

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: Modify neigh_list only with rcu-list functions

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 fed2826b490c ("batman-adv: add list of unique single hop neighbors per hard-interface")
---
 net/batman-adv/originator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/originator.c +1 -1
index 3940b5d..3e9667e 100644
@@ -537,7 +537,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);
Signature · 1 line
2.9.3
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Sven Eckelmann

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 fed2826b490c ("batman-adv: add list of unique single hop neighbors per hard-interface")
maintainer Applied
#2 lore raw
In reply to Sven Eckelmann
Quoted 6 lines · On Donnerstag, 29. September 2016 17:22:58 CEST Sven Eckelmann wrote:

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.

Quoted 7 lines
Fixes fed2826b490c ("batman-adv: add list of unique single hop neighbors

per hard-interface") Signed-off-by: Sven Eckelmann <[email protected]>

---
 net/batman-adv/originator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied in 0e384ddb1995ae400766cf33b95537fb115a7800 [1].

Kind regards,
Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/0e384ddb1995ae400766cf33b95537fb115a7800