aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBing Zhao <bzhao@marvell.com>2012-10-05 23:21:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-10-08 15:06:02 -0400
commitc2476335313e618c0368ffbe73e05bba4d0f5f89 (patch)
treee3f699424d9767e98ce9d2cb4605a59ad918c385 /drivers/net
parent55fabefe3695241e6ccfa0cd4974f3fa497693dc (diff)
mwifiex: return -EBUSY if scan request cannot be honored
There are cases we cannot scan when request is received. For example, during WPA group key negociation the scan request will be blocked. We should return an error code to cfg80211 because cfg80211_scan_done will never be called. Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Paul Stewart <pstew@chromium.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c10
-rw-r--r--drivers/net/wireless/mwifiex/scan.c18
2 files changed, 16 insertions, 12 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 2691620393ea..675247b303d7 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1802,7 +1802,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1802{ 1802{
1803 struct net_device *dev = request->wdev->netdev; 1803 struct net_device *dev = request->wdev->netdev;
1804 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1804 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1805 int i, offset; 1805 int i, offset, ret;
1806 struct ieee80211_channel *chan; 1806 struct ieee80211_channel *chan;
1807 struct ieee_types_header *ie; 1807 struct ieee_types_header *ie;
1808 1808
@@ -1855,8 +1855,12 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1855 1855
1856 priv->user_scan_cfg->chan_list[i].scan_time = 0; 1856 priv->user_scan_cfg->chan_list[i].scan_time = 0;
1857 } 1857 }
1858 if (mwifiex_scan_networks(priv, priv->user_scan_cfg)) 1858
1859 return -EFAULT; 1859 ret = mwifiex_scan_networks(priv, priv->user_scan_cfg);
1860 if (ret) {
1861 dev_err(priv->adapter->dev, "scan failed: %d\n", ret);
1862 return ret;
1863 }
1860 1864
1861 if (request->ie && request->ie_len) { 1865 if (request->ie && request->ie_len) {
1862 for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { 1866 for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) {
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index e36a75988f87..bfb90a55117a 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1296,7 +1296,7 @@ mwifiex_radio_type_to_band(u8 radio_type)
1296int mwifiex_scan_networks(struct mwifiex_private *priv, 1296int mwifiex_scan_networks(struct mwifiex_private *priv,
1297 const struct mwifiex_user_scan_cfg *user_scan_in) 1297 const struct mwifiex_user_scan_cfg *user_scan_in)
1298{ 1298{
1299 int ret = 0; 1299 int ret;
1300 struct mwifiex_adapter *adapter = priv->adapter; 1300 struct mwifiex_adapter *adapter = priv->adapter;
1301 struct cmd_ctrl_node *cmd_node; 1301 struct cmd_ctrl_node *cmd_node;
1302 union mwifiex_scan_cmd_config_tlv *scan_cfg_out; 1302 union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
@@ -1309,20 +1309,20 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1309 unsigned long flags; 1309 unsigned long flags;
1310 1310
1311 if (adapter->scan_processing) { 1311 if (adapter->scan_processing) {
1312 dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); 1312 dev_err(adapter->dev, "cmd: Scan already in process...\n");
1313 return ret; 1313 return -EBUSY;
1314 } 1314 }
1315 1315
1316 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1317 adapter->scan_processing = true;
1318 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1319
1320 if (priv->scan_block) { 1316 if (priv->scan_block) {
1321 dev_dbg(adapter->dev, 1317 dev_err(adapter->dev,
1322 "cmd: Scan is blocked during association...\n"); 1318 "cmd: Scan is blocked during association...\n");
1323 return ret; 1319 return -EBUSY;
1324 } 1320 }
1325 1321
1322 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1323 adapter->scan_processing = true;
1324 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1325
1326 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), 1326 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
1327 GFP_KERNEL); 1327 GFP_KERNEL);
1328 if (!scan_cfg_out) { 1328 if (!scan_cfg_out) {