aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2011-07-21 03:22:50 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-08-09 12:45:22 -0400
commit6fd1eacec1b8cd081b9ae067f852cece3e886521 (patch)
tree703069f9eecb4857f0d25032795d8fca61e566c4
parentcf104c2a207f550d9c3b8f8bcf73cb11765692f6 (diff)
ath6kl: fix crash when interface is closed but scan is ongoing
When ath6kl module was removed while a scan was ongoing the driver would crash in ath6kl_cfg80211_scan_complete_event(). Fix the function not to iterate nodes when the scan is aborted. The nodes are already freed when the module is being unloaded. This patch removes the null check entirely as the wmi structure is not accessed anymore during module unload. Also fix a bug where the status was checked as a bitfield with '&' operator. But it's not a bitfield, just a regular error code. This is a port of my patch from ath6kl staging with the same title. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index eff99837819e..d1d479451409 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -820,29 +820,34 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
820 820
821void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status) 821void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status)
822{ 822{
823 int i;
823 824
824 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status %d\n", __func__, status); 825 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status %d\n", __func__, status);
825 826
826 if (ar->scan_req) { 827 if (!ar->scan_req)
827 /* Translate data to cfg80211 mgmt format */ 828 return;
828 ath6kl_wmi_iterate_nodes(ar->wmi, ath6kl_cfg80211_scan_node, 829
829 ar->wdev->wiphy); 830 if ((status == -ECANCELED) || (status == -EBUSY)) {
830 831 cfg80211_scan_done(ar->scan_req, true);
831 cfg80211_scan_done(ar->scan_req, ((status & -ECANCELED) 832 goto out;
832 || (status & -EBUSY)) ? true : 833 }
833 false); 834
834 835 /* Translate data to cfg80211 mgmt format */
835 if (ar->scan_req->n_ssids && ar->scan_req->ssids[0].ssid_len) { 836 ath6kl_wmi_iterate_nodes(ar->wmi, ath6kl_cfg80211_scan_node,
836 u8 i; 837 ar->wdev->wiphy);
837 838
838 for (i = 0; i < ar->scan_req->n_ssids; i++) { 839 cfg80211_scan_done(ar->scan_req, false);
839 ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1, 840
840 DISABLE_SSID_FLAG, 841 if (ar->scan_req->n_ssids && ar->scan_req->ssids[0].ssid_len) {
841 0, NULL); 842 for (i = 0; i < ar->scan_req->n_ssids; i++) {
842 } 843 ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1,
844 DISABLE_SSID_FLAG,
845 0, NULL);
843 } 846 }
844 ar->scan_req = NULL;
845 } 847 }
848
849out:
850 ar->scan_req = NULL;
846} 851}
847 852
848static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, 853static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,