Skip to contentSkip to conversation

mac80211: use rcu_read_lock before sta_info_get

RFC In review Mohammed Shafi Shajakhan 2 participants 3 messages Dec 25, 2011 – Dec 26, 2011 mac80211

lore
Share & tools
lore
#0 lore raw

RFC 1/1 mac80211: use rcu_read_lock before sta_info_get

From: Mohammed Shafi Shajakhan <[email protected]>

---
 net/mac80211/mlme.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/mac80211/mlme.c +2 -0
index 57989a0..c8a1acc 100644
@@ -1385,7 +1385,9 @@ void ieee80211_beacon_connection_loss_work(struct work_struct *work)
 	struct sta_info *sta;
 
 	if (ifmgd->associated) {
+		rcu_read_lock();
 		sta = sta_info_get(sdata, ifmgd->bssid);
+		rcu_read_unlock();
 		if (sta)
 			sta->beacon_loss_count++;
 	}
Signature · 1 line
1.7.0.4
#1 lore raw

net/mac80211/mlme.c void ieee80211_beacon_connection_loss_work(struct work_struct *work) · line 1393

Quoted 10 lines · On Sunday 25 December 2011 16:09:12 Mohammed Shafi Shajakhan wrote:
net/mac80211/mlme.c +2 -0
@@ -1385,7 +1385,9 @@ void ieee80211_beacon_connection_loss_work(struct work_struct *work)
 	struct sta_info *sta;
 
 	if (ifmgd->associated) {
+		rcu_read_lock();
 		sta = sta_info_get(sdata, ifmgd->bssid);
+		rcu_read_unlock();
 		if (sta)
 			sta->beacon_loss_count++;
 	}

uh, I think it should be:

net/mac80211/mlme.c void ieee80211_beacon_connection_loss_work(struct work_struct *work)

Quoted 5 lines
net/mac80211/mlme.c +2 -0
+		rcu_read_lock();
 		sta = sta_info_get(sdata, ifmgd->bssid);
 		if (sta)
 			sta->beacon_loss_count++;
+		rcu_read_unlock();

Since we update a member of the rcu-protected "sta" reference.

Regards,
Chr

#2 lore raw

Hi Christian,

thanks for your review!

Quoted 14 lines · Christian Lamparter

net/mac80211/mlme.c void ieee80211_beacon_connection_loss_work(struct work_struct *work) · line 1393

Quoted 10 lines · On Sunday 25 December 2011 16:09:12 Mohammed Shafi Shajakhan wrote:
net/mac80211/mlme.c +2 -0
@@ -1385,7 +1385,9 @@ void ieee80211_beacon_connection_loss_work(struct work_struct *work)
  	struct sta_info *sta;
 
  	if (ifmgd->associated) {
+		rcu_read_lock();
  		sta = sta_info_get(sdata, ifmgd->bssid);
+		rcu_read_unlock();
  		if (sta)
  			sta->beacon_loss_count++;
  	}

uh, I think it should be:

Quoted 8 lines

net/mac80211/mlme.c void ieee80211_beacon_connection_loss_work(struct work_struct *work)

Quoted 5 lines
net/mac80211/mlme.c +2 -0
+		rcu_read_lock();
  		sta = sta_info_get(sdata, ifmgd->bssid);
  		if (sta)
  			sta->beacon_loss_count++;
+		rcu_read_unlock();

Since we update a member of the rcu-protected "sta" reference.

ok i will add this changes also in a proper patch, thank you.

Quoted 3 lines

Regards,
Chr

Signature · 2 lines
thanks,
shafi