Skip to contentSkip to conversation

mac80211: clean up mesh RCU warning

PATCH In review Thomas Pedersen 2 participants 2 messages May 2, 2013 – May 3, 2013 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: clean up mesh RCU warning

When running a kernel with CONFIG_PROVE_RCU, the minstrel rate update code would complain about being called without the RCU read lock held. This is because mesh_sta_info_init() may or may not have been called under RCU read lock. Perform some bureaucratic critical section toggling to always call mesh_sta_info_init() under RCU, and silence this warning.

---
 net/mac80211/mesh_plink.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/mac80211/mesh_plink.c +5 -3
index 09bebed..4058bd7 100644
@@ -473,13 +473,15 @@ mesh_sta_info_get(struct ieee80211_sub_if_data *sdata,
 		rcu_read_unlock();
 		/* can't run atomic */
 		sta = mesh_sta_info_alloc(sdata, addr, elems);
-		if (!sta) {
-			rcu_read_lock();
+
+		rcu_read_lock();
+		if (!sta)
 			return NULL;
-		}
 
 		mesh_sta_info_init(sdata, sta, elems, true);
 
+		rcu_read_unlock();
+		/* also might sleep */
 		if (sta_info_insert_rcu(sta))
 			return NULL;
 	}
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 7 lines · Thomas Pedersen

When running a kernel with CONFIG_PROVE_RCU, the minstrel rate update code would complain about being called without the RCU read lock held. This is because mesh_sta_info_init() may or may not have been called under RCU read lock. Perform some bureaucratic critical section toggling to always call mesh_sta_info_init() under RCU, and silence this warning.

This was discussed in another thread a while ago, but unfortunately nothing came out of it. I really don't think this is the right solution, since the code that this calls doesn't even use rcu_dereference() properly.

Felix, please come up with a proper fix soon, otherwise I'm going to revert your changes for 3.10.

johannes