Skip to content

Commit

Permalink
mac80211: fix scan locking wrt. hw scan
Browse files Browse the repository at this point in the history
Releasing the scan mutex while starting scans
can lead to unexpected things happening, so
we shouldn't do that. Fix that and hold the
mutex across the scan triggering.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Aug 4, 2010
1 parent 02f5ba5 commit 1601b1e
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,28 +400,14 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
else
__set_bit(SCAN_SW_SCANNING, &local->scanning);

/*
* Kicking off the scan need not be protected,
* only the scan variable stuff, since now
* local->scan_req is assigned and other callers
* will abort their scan attempts.
*
* This avoids too many locking dependencies
* so that the scan completed calls have more
* locking freedom.
*/

ieee80211_recalc_idle(local);
mutex_unlock(&local->scan_mtx);

if (local->ops->hw_scan) {
WARN_ON(!ieee80211_prep_hw_scan(local));
rc = drv_hw_scan(local, sdata, local->hw_scan_req);
} else
rc = ieee80211_start_sw_scan(local);

mutex_lock(&local->scan_mtx);

if (rc) {
kfree(local->hw_scan_req);
local->hw_scan_req = NULL;
Expand Down

0 comments on commit 1601b1e

Please sign in to comment.