diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2015-01-07 06:57:39 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-23 12:03:15 -0500 |
commit | e00483f74682ea6aa7f3839a980c7cdb548de4d2 (patch) | |
tree | fd57340f2e489025363c619ef2c6f44f28814033 /drivers/net/wireless | |
parent | 2b5b8f19fbf3b8337599db33cdf1afa84c1dde8d (diff) |
mwifiex: check driver status in connect and scan handlers
Ignore scan and connection requests from cfg80211 when driver
unload is in process or previous command has timed out due to
a firmware bug. This patch fixes corner case system crash
issues.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index b3bf2cd150b7..7be1e9b83fd0 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1786,6 +1786,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1786 | struct cfg80211_connect_params *sme) | 1786 | struct cfg80211_connect_params *sme) |
1787 | { | 1787 | { |
1788 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1788 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1789 | struct mwifiex_adapter *adapter = priv->adapter; | ||
1789 | int ret; | 1790 | int ret; |
1790 | 1791 | ||
1791 | if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { | 1792 | if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { |
@@ -1800,6 +1801,13 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1800 | return -EALREADY; | 1801 | return -EALREADY; |
1801 | } | 1802 | } |
1802 | 1803 | ||
1804 | if (adapter->surprise_removed || adapter->is_cmd_timedout) { | ||
1805 | wiphy_err(wiphy, | ||
1806 | "%s: Ignore connection. Card removed or FW in bad state\n", | ||
1807 | dev->name); | ||
1808 | return -EFAULT; | ||
1809 | } | ||
1810 | |||
1803 | wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", | 1811 | wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", |
1804 | (char *) sme->ssid, sme->bssid); | 1812 | (char *) sme->ssid, sme->bssid); |
1805 | 1813 | ||
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 984a7a4fa93b..e304f0731647 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1429,6 +1429,12 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1429 | return -EBUSY; | 1429 | return -EBUSY; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | if (adapter->surprise_removed || adapter->is_cmd_timedout) { | ||
1433 | dev_err(adapter->dev, | ||
1434 | "Ignore scan. Card removed or firmware in bad state\n"); | ||
1435 | return -EFAULT; | ||
1436 | } | ||
1437 | |||
1432 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); | 1438 | spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); |
1433 | adapter->scan_processing = true; | 1439 | adapter->scan_processing = true; |
1434 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | 1440 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |