Skip to contentSkip to conversation

mac80211: Don't restart sta-timer if not associated.

PATCH Superseded [email protected] 2 participants 3 messages Mar 15, 2013 – Mar 19, 2013 mac80211

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mac80211: Don't restart sta-timer if not associated.

From: Ben Greear <[email protected]>

I found another crash when deleting lots of virtual stations in a congested environment. I think the problem is that the ieee80211_mlme_notify_scan_completed could call ieee80211_restart_sta_timer for a non-associated interface that was about to be deleted.

With the following patch I am unable to reproduce the crash.

---
v2: Be more selective: Still need to do sdata->work even
if not associated so that we *can* associate.

:100644 100644 81e0619... da805e2... M net/mac80211/mlme.c

 net/mac80211/mlme.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +5 -2
index 81e0619..da805e2 100644
@@ -2935,11 +2935,14 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
 
 		/* let's probe the connection once */
 		flags = sdata->local->hw.flags;
-		if (!(flags & IEEE80211_HW_CONNECTION_MONITOR))
+		if ((!(flags & IEEE80211_HW_CONNECTION_MONITOR)) &&
+		    sdata->u.mgd.associated)
 			ieee80211_queue_work(&sdata->local->hw,
 					     &sdata->u.mgd.monitor_work);
+
 		/* and do all the other regular work too */
-		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
+		if (ieee80211_sdata_running(sdata))
+			ieee80211_queue_work(&sdata->local->hw, &sdata->work);
 	}
 }
 
Signature · 1 line
1.7.3.4
maintainer
#1 lore raw
Quoted 25 lines · On Thu, 2013-03-14 at 17:24 -0700, [email protected] wrote:

From: Ben Greear <[email protected]>

I found another crash when deleting lots of virtual stations in a congested environment. I think the problem is that the ieee80211_mlme_notify_scan_completed could call ieee80211_restart_sta_timer for a non-associated interface that was about to be deleted.

With the following patch I am unable to reproduce the crash.

---
v2: Be more selective: Still need to do sdata->work even
if not associated so that we *can* associate.

:100644 100644 81e0619... da805e2... M net/mac80211/mlme.c

 net/mac80211/mlme.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +0 -0
index 81e0619..da805e2 100644

net/mac80211/mlme.c static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) · line 2939

Quoted 6 lines
net/mac80211/mlme.c +2 -1
@@ -2935,11 +2935,14 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
 
 		/* let's probe the connection once */
 		flags = sdata->local->hw.flags;
-		if (!(flags & IEEE80211_HW_CONNECTION_MONITOR))
+		if ((!(flags & IEEE80211_HW_CONNECTION_MONITOR)) &&
+		    sdata->u.mgd.associated)

You really didn't need those extra parentheses :-)

net/mac80211/mlme.c static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) · line 2945

Quoted 7 lines
net/mac80211/mlme.c +3 -1
 			ieee80211_queue_work(&sdata->local->hw,
 					     &sdata->u.mgd.monitor_work);
+
 		/* and do all the other regular work too */
-		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
+		if (ieee80211_sdata_running(sdata))
+			ieee80211_queue_work(&sdata->local->hw, &sdata->work);

Overall, it seems that it would be safe to just check ieee80211_sdata_running() in the beginning of the function instead?

Maybe you could also look at the ibss/mesh code and fix this issue for good?

johannes

author
#2 lore raw
Quoted 27 lines · Johannes Berg
Quoted 26 lines · On Thu, 2013-03-14 at 17:24 -0700, [email protected] wrote:

From: Ben Greear <[email protected]>

I found another crash when deleting lots of virtual stations in a congested environment. I think the problem is that the ieee80211_mlme_notify_scan_completed could call ieee80211_restart_sta_timer for a non-associated interface that was about to be deleted.

With the following patch I am unable to reproduce the crash.

---
v2: Be more selective: Still need to do sdata->work even
if not associated so that we *can* associate.

:100644 100644 81e0619... da805e2... M net/mac80211/mlme.c

  net/mac80211/mlme.c |    7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +0 -0
index 81e0619..da805e2 100644
@@ -2935,11 +2935,14 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
 
Quoted 7 lines

net/mac80211/mlme.c static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) · line 2939

Quoted 5 lines
net/mac80211/mlme.c +2 -1
  		/* let's probe the connection once */
  		flags = sdata->local->hw.flags;
-		if (!(flags & IEEE80211_HW_CONNECTION_MONITOR))
+		if ((!(flags & IEEE80211_HW_CONNECTION_MONITOR)) &&
+		    sdata->u.mgd.associated)

You really didn't need those extra parentheses :-)

I like them :)

...never can remember if the ! operator takes
precedence over &&, but can remove them...

Quoted 10 lines

net/mac80211/mlme.c static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) · line 2945

Quoted 7 lines
net/mac80211/mlme.c +3 -1
  			ieee80211_queue_work(&sdata->local->hw,
  					     &sdata->u.mgd.monitor_work);
+
  		/* and do all the other regular work too */
-		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
+		if (ieee80211_sdata_running(sdata))
+			ieee80211_queue_work(&sdata->local->hw, &sdata->work);

Overall, it seems that it would be safe to just check ieee80211_sdata_running() in the beginning of the function instead?

I'm not sure. I can look at the code closer tomorrow perhaps.

Quoted 2 lines

Maybe you could also look at the ibss/mesh code and fix this issue for good?

Will poke around in that as well, but I have no way to test it currently.

Ben

Quoted 3 lines

johannes

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com