aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r--net/mac80211/scan.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 3bf9839f5916..f25b07feabf9 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -253,7 +253,7 @@ static void ieee80211_scan_ps_disable(struct ieee80211_sub_if_data *sdata)
253{ 253{
254 struct ieee80211_local *local = sdata->local; 254 struct ieee80211_local *local = sdata->local;
255 255
256 if (!local->powersave) 256 if (!local->ps_sdata)
257 ieee80211_send_nullfunc(local, sdata, 0); 257 ieee80211_send_nullfunc(local, sdata, 0);
258 else { 258 else {
259 /* 259 /*
@@ -285,12 +285,16 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
285 if (WARN_ON(!local->scan_req)) 285 if (WARN_ON(!local->scan_req))
286 return; 286 return;
287 287
288 if (local->hw_scanning) {
289 kfree(local->scan_req->ie);
290 local->scan_req->ie = local->orig_ies;
291 local->scan_req->ie_len = local->orig_ies_len;
292 }
293
288 if (local->scan_req != &local->int_scan_req) 294 if (local->scan_req != &local->int_scan_req)
289 cfg80211_scan_done(local->scan_req, aborted); 295 cfg80211_scan_done(local->scan_req, aborted);
290 local->scan_req = NULL; 296 local->scan_req = NULL;
291 297
292 local->last_scan_completed = jiffies;
293
294 if (local->hw_scanning) { 298 if (local->hw_scanning) {
295 local->hw_scanning = false; 299 local->hw_scanning = false;
296 /* 300 /*
@@ -457,12 +461,28 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
457 } 461 }
458 462
459 if (local->ops->hw_scan) { 463 if (local->ops->hw_scan) {
460 int rc; 464 u8 *ies;
465 int rc, ielen;
466
467 ies = kmalloc(2 + IEEE80211_MAX_SSID_LEN +
468 local->scan_ies_len + req->ie_len, GFP_KERNEL);
469 if (!ies)
470 return -ENOMEM;
471
472 ielen = ieee80211_build_preq_ies(local, ies,
473 req->ie, req->ie_len);
474 local->orig_ies = req->ie;
475 local->orig_ies_len = req->ie_len;
476 req->ie = ies;
477 req->ie_len = ielen;
461 478
462 local->hw_scanning = true; 479 local->hw_scanning = true;
463 rc = local->ops->hw_scan(local_to_hw(local), req); 480 rc = local->ops->hw_scan(local_to_hw(local), req);
464 if (rc) { 481 if (rc) {
465 local->hw_scanning = false; 482 local->hw_scanning = false;
483 kfree(ies);
484 req->ie_len = local->orig_ies_len;
485 req->ie = local->orig_ies;
466 return rc; 486 return rc;
467 } 487 }
468 local->scan_sdata = scan_sdata; 488 local->scan_sdata = scan_sdata;