diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2015-02-06 03:19:05 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-02-23 15:22:44 -0500 |
commit | e7d3abab81bfb9cda80b7f5aa027fbf9e62a37fd (patch) | |
tree | 822479b16ce0533bb7148bfe596f1f6743f1eb88 /drivers/net | |
parent | 57bff1485096c53f943e26b1c5847f2a9dfe84db (diff) |
iwlwifi: mvm: don't try to stop scans that are not running anymore
In certain conditions, mac80211 may ask us to stop a scan (scheduled
or normal) that is not running anymore. This can also happen when we
are doing a different type of scan, for instance, mac80211 can ask us
to stop a scheduled scan when we are running a normal scan, due to
some race conditions. In this case, we would stop the wrong type of
scan and leave everything everything in a wrong state.
To fix this, simply ignore scan stop requests for scans types that are
not running.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 1ff7ec08532d..35feebfd048f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -2215,7 +2215,19 @@ static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, | |||
2215 | 2215 | ||
2216 | mutex_lock(&mvm->mutex); | 2216 | mutex_lock(&mvm->mutex); |
2217 | 2217 | ||
2218 | iwl_mvm_cancel_scan(mvm); | 2218 | /* Due to a race condition, it's possible that mac80211 asks |
2219 | * us to stop a hw_scan when it's already stopped. This can | ||
2220 | * happen, for instance, if we stopped the scan ourselves, | ||
2221 | * called ieee80211_scan_completed() and the userspace called | ||
2222 | * cancel scan scan before ieee80211_scan_work() could run. | ||
2223 | * To handle that, simply return if the scan is not running. | ||
2224 | */ | ||
2225 | /* FIXME: for now, we ignore this race for UMAC scans, since | ||
2226 | * they don't set the scan_status. | ||
2227 | */ | ||
2228 | if ((mvm->scan_status == IWL_MVM_SCAN_OS) || | ||
2229 | (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) | ||
2230 | iwl_mvm_cancel_scan(mvm); | ||
2219 | 2231 | ||
2220 | mutex_unlock(&mvm->mutex); | 2232 | mutex_unlock(&mvm->mutex); |
2221 | } | 2233 | } |
@@ -2559,12 +2571,29 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, | |||
2559 | int ret; | 2571 | int ret; |
2560 | 2572 | ||
2561 | mutex_lock(&mvm->mutex); | 2573 | mutex_lock(&mvm->mutex); |
2574 | |||
2575 | /* Due to a race condition, it's possible that mac80211 asks | ||
2576 | * us to stop a sched_scan when it's already stopped. This | ||
2577 | * can happen, for instance, if we stopped the scan ourselves, | ||
2578 | * called ieee80211_sched_scan_stopped() and the userspace called | ||
2579 | * stop sched scan scan before ieee80211_sched_scan_stopped_work() | ||
2580 | * could run. To handle this, simply return if the scan is | ||
2581 | * not running. | ||
2582 | */ | ||
2583 | /* FIXME: for now, we ignore this race for UMAC scans, since | ||
2584 | * they don't set the scan_status. | ||
2585 | */ | ||
2586 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && | ||
2587 | !(mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { | ||
2588 | mutex_unlock(&mvm->mutex); | ||
2589 | return 0; | ||
2590 | } | ||
2591 | |||
2562 | ret = iwl_mvm_scan_offload_stop(mvm, false); | 2592 | ret = iwl_mvm_scan_offload_stop(mvm, false); |
2563 | mutex_unlock(&mvm->mutex); | 2593 | mutex_unlock(&mvm->mutex); |
2564 | iwl_mvm_wait_for_async_handlers(mvm); | 2594 | iwl_mvm_wait_for_async_handlers(mvm); |
2565 | 2595 | ||
2566 | return ret; | 2596 | return ret; |
2567 | |||
2568 | } | 2597 | } |
2569 | 2598 | ||
2570 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | 2599 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, |