diff options
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 08afe74b98f4..d2d17a449224 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; |
@@ -940,7 +943,23 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) | |||
940 | if (!local->scan_req) | 943 | if (!local->scan_req) |
941 | goto out; | 944 | goto out; |
942 | 945 | ||
946 | /* | ||
947 | * We have a scan running and the driver already reported completion, | ||
948 | * but the worker hasn't run yet or is stuck on the mutex - mark it as | ||
949 | * cancelled. | ||
950 | */ | ||
951 | if (test_bit(SCAN_HW_SCANNING, &local->scanning) && | ||
952 | test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
953 | set_bit(SCAN_HW_CANCELLED, &local->scanning); | ||
954 | goto out; | ||
955 | } | ||
956 | |||
943 | if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { | 957 | if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { |
958 | /* | ||
959 | * Make sure that __ieee80211_scan_completed doesn't trigger a | ||
960 | * scan on another band. | ||
961 | */ | ||
962 | set_bit(SCAN_HW_CANCELLED, &local->scanning); | ||
944 | if (local->ops->cancel_hw_scan) | 963 | if (local->ops->cancel_hw_scan) |
945 | drv_cancel_hw_scan(local, | 964 | drv_cancel_hw_scan(local, |
946 | rcu_dereference_protected(local->scan_sdata, | 965 | rcu_dereference_protected(local->scan_sdata, |