Skip to contentSkip to conversation

mac80211: fix sw scan locking

PATCH In review Johannes Berg 2 participants 2 messages Oct 7, 2010 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: fix sw scan locking

From: Johannes Berg <[email protected]>

The recent scan overhaul broke locking because now we can jump to code that attempts to unlock, while we don't have the mutex held. Fix this by holding the mutex around all the relevant code.

---
 net/mac80211/scan.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/scan.c +1 -2
@@ -682,8 +682,6 @@ void ieee80211_scan_work(struct work_str
 		goto out_complete;
 	}
 
-	mutex_unlock(&local->mtx);
-
 	/*
 	 * as long as no delay is required advance immediately
 	 * without scheduling a new work
@@ -714,6 +712,7 @@ void ieee80211_scan_work(struct work_str
 	} while (next_delay == 0);
 
 	ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay);
+	mutex_unlock(&local->mtx);
 	return;
 
 out_complete:
#1 lore raw
Quoted 10 lines · Johannes Berg

From: Johannes Berg<[email protected]>

The recent scan overhaul broke locking because now we can jump to code that attempts to unlock, while we don't have the mutex held. Fix this by holding the mutex around all the relevant code.

That does indeed fix the problem for me.

Thanks,
Ben

Quoted 24 lines
---
  net/mac80211/scan.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/scan.c +1 -2
@@ -682,8 +682,6 @@ void ieee80211_scan_work(struct work_str
  		goto out_complete;
  	}
 
-	mutex_unlock(&local->mtx);
-
  	/*
  	 * as long as no delay is required advance immediately
  	 * without scheduling a new work
@@ -714,6 +712,7 @@ void ieee80211_scan_work(struct work_str
  	} while (next_delay == 0);
 
  	ieee80211_queue_delayed_work(&local->hw,&local->scan_work, next_delay);
+	mutex_unlock(&local->mtx);
  	return;
 
  out_complete:
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com