Commit f162cac8 authored by Amitkumar Karwar's avatar Amitkumar Karwar Committed by John W. Linville

mwifiex: abort scan upon interface down

When the interface is down, we will abort scan by calling
cfg80211_scan_done() with abort option. This fixes WARN_ON
triggered by cfg80211 in wdev_cleanup_work().

Driver's internal variables/flags are cleared once we get
response for current scan command. Meanwhile we will block
new scan request from cfg80211.
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e45a8419
...@@ -1828,6 +1828,11 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, ...@@ -1828,6 +1828,11 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
priv->scan_request = request; priv->scan_request = request;
if (priv->user_scan_cfg) {
dev_err(priv->adapter->dev, "cmd: Scan already in process..\n");
return -EBUSY;
}
priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
GFP_KERNEL); GFP_KERNEL);
if (!priv->user_scan_cfg) { if (!priv->user_scan_cfg) {
......
...@@ -84,10 +84,16 @@ static void scan_delay_timer_fn(unsigned long data) ...@@ -84,10 +84,16 @@ static void scan_delay_timer_fn(unsigned long data)
spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
if (priv->user_scan_cfg) { if (priv->user_scan_cfg) {
dev_dbg(priv->adapter->dev, if (priv->scan_request) {
"info: %s: scan aborted\n", __func__); dev_dbg(priv->adapter->dev,
cfg80211_scan_done(priv->scan_request, 1); "info: aborting scan\n");
priv->scan_request = NULL; cfg80211_scan_done(priv->scan_request, 1);
priv->scan_request = NULL;
} else {
dev_dbg(priv->adapter->dev,
"info: scan already aborted\n");
}
kfree(priv->user_scan_cfg); kfree(priv->user_scan_cfg);
priv->user_scan_cfg = NULL; priv->user_scan_cfg = NULL;
} }
......
...@@ -472,6 +472,14 @@ mwifiex_open(struct net_device *dev) ...@@ -472,6 +472,14 @@ mwifiex_open(struct net_device *dev)
static int static int
mwifiex_close(struct net_device *dev) mwifiex_close(struct net_device *dev)
{ {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
if (priv->scan_request) {
dev_dbg(priv->adapter->dev, "aborting scan on ndo_stop\n");
cfg80211_scan_done(priv->scan_request, 1);
priv->scan_request = NULL;
}
return 0; return 0;
} }
......
...@@ -1768,16 +1768,29 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, ...@@ -1768,16 +1768,29 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
} }
if (priv->user_scan_cfg) { if (priv->user_scan_cfg) {
dev_dbg(priv->adapter->dev, if (priv->scan_request) {
"info: %s: sending scan results\n", __func__); dev_dbg(priv->adapter->dev,
cfg80211_scan_done(priv->scan_request, 0); "info: notifying scan done\n");
priv->scan_request = NULL; cfg80211_scan_done(priv->scan_request, 0);
priv->scan_request = NULL;
} else {
dev_dbg(priv->adapter->dev,
"info: scan already aborted\n");
}
kfree(priv->user_scan_cfg); kfree(priv->user_scan_cfg);
priv->user_scan_cfg = NULL; priv->user_scan_cfg = NULL;
} }
} else { } else {
if (!mwifiex_wmm_lists_empty(adapter) && if (priv->user_scan_cfg && !priv->scan_request) {
(priv->scan_request && (priv->scan_request->flags & spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
flags);
adapter->scan_delay_cnt = MWIFIEX_MAX_SCAN_DELAY_CNT;
mod_timer(&priv->scan_delay_timer, jiffies);
dev_dbg(priv->adapter->dev,
"info: %s: triggerring scan abort\n", __func__);
} else if (!mwifiex_wmm_lists_empty(adapter) &&
(priv->scan_request && (priv->scan_request->flags &
NL80211_SCAN_FLAG_LOW_PRIORITY))) { NL80211_SCAN_FLAG_LOW_PRIORITY))) {
spin_unlock_irqrestore(&adapter->scan_pending_q_lock, spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
flags); flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment