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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index ecb57b0bf74a..5ad66a83ef7f 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -238,6 +238,9 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
238 enum ieee80211_band band; 238 enum ieee80211_band band;
239 int i, ielen, n_chans; 239 int i, ielen, n_chans;
240 240
241 if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
242 return false;
243
241 do { 244 do {
242 if (local->hw_scan_band == IEEE80211_NUM_BANDS) 245 if (local->hw_scan_band == IEEE80211_NUM_BANDS)
243 return false; 246 return false;
@@ -939,7 +942,23 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
939 if (!local->scan_req) 942 if (!local->scan_req)
940 goto out; 943 goto out;
941 944
945 /*
946 * We have a scan running and the driver already reported completion,
947 * but the worker hasn't run yet or is stuck on the mutex - mark it as
948 * cancelled.
949 */
950 if (test_bit(SCAN_HW_SCANNING, &local->scanning) &&
951 test_bit(SCAN_COMPLETED, &local->scanning)) {
952 set_bit(SCAN_HW_CANCELLED, &local->scanning);
953 goto out;
954 }
955
942 if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { 956 if (test_bit(SCAN_HW_SCANNING, &local->scanning)) {
957 /*
958 * Make sure that __ieee80211_scan_completed doesn't trigger a
959 * scan on another band.
960 */
961 set_bit(SCAN_HW_CANCELLED, &local->scanning);
943 if (local->ops->cancel_hw_scan) 962 if (local->ops->cancel_hw_scan)
944 drv_cancel_hw_scan(local, 963 drv_cancel_hw_scan(local,
945 rcu_dereference_protected(local->scan_sdata, 964 rcu_dereference_protected(local->scan_sdata,