aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2010-02-02 13:57:12 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-26 10:48:02 -0400
commit6722260b066a1de80228d71da99ab71ebdcc7ae8 (patch)
tree5544de39c4aeec40ad118372bbf34fb5016850bd /drivers/net
parent5393cd90a45d38d8457855ccff2240666554c815 (diff)
iwlwifi: fix scan race
commit bbcbb9ef9735c67da303d30bd6beb9e699f0f508 upstream. There is a problem if an "internal short scan" is in progress when a mac80211 requested scan arrives. If this new scan request arrives within the "next_scan_jiffies" period then driver will immediately return success and complete the scan. The problem here is that the scan has not been fully initialized at this time (is_internal_short_scan is still set to true because of the currently running scan), which results in the scan completion never to be sent to mac80211. At this time also, evan though the internal short scan is still running the state (is_internal_short_scan) will be set to false, so when the internal scan does complete then mac80211 will receive a scan completion. Fix this by checking right away if a scan is in progress when a scan request arrives from mac80211. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Cc: maximilian attems <max@stro.at> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index fa1c89ba6459..8f1b8509cd66 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -404,21 +404,6 @@ EXPORT_SYMBOL(iwl_init_scan_params);
404 404
405static int iwl_scan_initiate(struct iwl_priv *priv) 405static int iwl_scan_initiate(struct iwl_priv *priv)
406{ 406{
407 if (!iwl_is_ready_rf(priv)) {
408 IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n");
409 return -EIO;
410 }
411
412 if (test_bit(STATUS_SCANNING, &priv->status)) {
413 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
414 return -EAGAIN;
415 }
416
417 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
418 IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n");
419 return -EAGAIN;
420 }
421
422 IWL_DEBUG_INFO(priv, "Starting scan...\n"); 407 IWL_DEBUG_INFO(priv, "Starting scan...\n");
423 set_bit(STATUS_SCANNING, &priv->status); 408 set_bit(STATUS_SCANNING, &priv->status);
424 priv->scan_start = jiffies; 409 priv->scan_start = jiffies;
@@ -449,6 +434,18 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
449 goto out_unlock; 434 goto out_unlock;
450 } 435 }
451 436
437 if (test_bit(STATUS_SCANNING, &priv->status)) {
438 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
439 ret = -EAGAIN;
440 goto out_unlock;
441 }
442
443 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
444 IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n");
445 ret = -EAGAIN;
446 goto out_unlock;
447 }
448
452 /* We don't schedule scan within next_scan_jiffies period. 449 /* We don't schedule scan within next_scan_jiffies period.
453 * Avoid scanning during possible EAPOL exchange, return 450 * Avoid scanning during possible EAPOL exchange, return
454 * success immediately. 451 * success immediately.