Skip to contentSkip to conversation

mwifiex: return -EBUSY if specific scan request cannot be honored

PATCH New Bing Zhao 1 participant 2 messages Oct 20, 2012 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/2 mwifiex: return -EBUSY if specific scan request cannot be honored

Previous patch "mwifiex: return -EBUSY if scan request cannot.." corrected regular scan request only. There is another case for specific scan that needs the same handling.

Also, removed !req_ssid check as it has already been validated by caller.

---
 drivers/net/wireless/mwifiex/scan.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
drivers/net/wireless/mwifiex/scan.c +5 -8
index 5896b1f..fe05684 100644
@@ -1846,21 +1846,18 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
 				      struct cfg80211_ssid *req_ssid)
 {
 	struct mwifiex_adapter *adapter = priv->adapter;
-	int ret = 0;
+	int ret;
 	struct mwifiex_user_scan_cfg *scan_cfg;
 
-	if (!req_ssid)
-		return -1;
-
 	if (adapter->scan_processing) {
-		dev_dbg(adapter->dev, "cmd: Scan already in process...\n");
-		return ret;
+		dev_err(adapter->dev, "cmd: Scan already in process...\n");
+		return -EBUSY;
 	}
 
 	if (priv->scan_block) {
-		dev_dbg(adapter->dev,
+		dev_err(adapter->dev,
 			"cmd: Scan is blocked during association...\n");
-		return ret;
+		return -EBUSY;
 	}
 
 	scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL);
Signature · 1 line
1.7.0.2
author
#1 lore raw

PATCH 2/2 mwifiex: clean up scan state on error

De-reference and deallocate scan state on failure.

---
 drivers/net/wireless/mwifiex/cfg80211.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +5 -2
index 38a5871..9aead8a 100644
@@ -1825,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 		return -EBUSY;
 	}
 
-	priv->scan_request = request;
-
 	priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
 				      GFP_KERNEL);
 	if (!priv->user_scan_cfg) {
@@ -1834,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 		return -ENOMEM;
 	}
 
+	priv->scan_request = request;
+
 	priv->user_scan_cfg->num_ssids = request->n_ssids;
 	priv->user_scan_cfg->ssid_list = request->ssids;
 
@@ -1870,6 +1870,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 	ret = mwifiex_scan_networks(priv, priv->user_scan_cfg);
 	if (ret) {
 		dev_err(priv->adapter->dev, "scan failed: %d\n", ret);
+		priv->scan_request = NULL;
+		kfree(priv->user_scan_cfg);
+		priv->user_scan_cfg = NULL;
 		return ret;
 	}
 
Signature · 1 line
1.7.0.2