diff options
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 3bf9839f5916..4ec1bfc7f6a9 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -285,6 +285,12 @@ 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; |
@@ -457,12 +463,28 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata, | |||
457 | } | 463 | } |
458 | 464 | ||
459 | if (local->ops->hw_scan) { | 465 | if (local->ops->hw_scan) { |
460 | int rc; | 466 | u8 *ies; |
467 | int rc, ielen; | ||
468 | |||
469 | ies = kmalloc(2 + IEEE80211_MAX_SSID_LEN + | ||
470 | local->scan_ies_len + req->ie_len, GFP_KERNEL); | ||
471 | if (!ies) | ||
472 | return -ENOMEM; | ||
473 | |||
474 | ielen = ieee80211_build_preq_ies(local, ies, | ||
475 | req->ie, req->ie_len); | ||
476 | local->orig_ies = req->ie; | ||
477 | local->orig_ies_len = req->ie_len; | ||
478 | req->ie = ies; | ||
479 | req->ie_len = ielen; | ||
461 | 480 | ||
462 | local->hw_scanning = true; | 481 | local->hw_scanning = true; |
463 | rc = local->ops->hw_scan(local_to_hw(local), req); | 482 | rc = local->ops->hw_scan(local_to_hw(local), req); |
464 | if (rc) { | 483 | if (rc) { |
465 | local->hw_scanning = false; | 484 | local->hw_scanning = false; |
485 | kfree(ies); | ||
486 | req->ie_len = local->orig_ies_len; | ||
487 | req->ie = local->orig_ies; | ||
466 | return rc; | 488 | return rc; |
467 | } | 489 | } |
468 | local->scan_sdata = scan_sdata; | 490 | local->scan_sdata = scan_sdata; |