2011-12-25 15:09:20

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: [RFC] mac80211: use rcu_read_lock before sta_info_get

From: Mohammed Shafi Shajakhan <[email protected]>

Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
net/mac80211/mlme.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 57989a0..c8a1acc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -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++;
}
--
1.7.0.4



2011-12-25 16:58:48

by Christian Lamparter

[permalink] [raw]
Subject: Re: [RFC] mac80211: use rcu_read_lock before sta_info_get

On Sunday 25 December 2011 16:09:12 Mohammed Shafi Shajakhan wrote:
> @@ -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:

> + 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

2011-12-26 05:15:12

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: Re: [RFC] mac80211: use rcu_read_lock before sta_info_get

Hi Christian,

thanks for your review!

On Sunday 25 December 2011 10:28 PM, Christian Lamparter wrote:
> On Sunday 25 December 2011 16:09:12 Mohammed Shafi Shajakhan wrote:
>> @@ -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:
>
>> + 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.

>
> Regards,
> Chr


--
thanks,
shafi