Commit e8041cee authored by Avinash Patil's avatar Avinash Patil Committed by John W. Linville

mwifiex: inform cfg80211 about disconnect if device is removed

If device is surprise removed, commands sent to FW including
deauthenticate command fail as bus writes fail.
We update our media_connected status to false and inform cfg80211
about disconnection only when command is successful. Since cfg80211
assumes device is still connected, it results into following
WARN_ON during unload:

WARNING: CPU: 0 PID: 18245 at net/wireless/core.c:937
         cfg80211_netdev_notifier_call+0x175/0x4d0 [cfg80211]()

Avoid this by emitting cfg80211_disconnected event even if the
deauthenticate command fails.
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4db89e14
...@@ -1422,13 +1422,19 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac) ...@@ -1422,13 +1422,19 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)
*/ */
int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac) int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
{ {
int ret = 0;
if (!priv->media_connected) if (!priv->media_connected)
return 0; return 0;
switch (priv->bss_mode) { switch (priv->bss_mode) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_P2P_CLIENT:
return mwifiex_deauthenticate_infra(priv, mac); ret = mwifiex_deauthenticate_infra(priv, mac);
if (ret)
cfg80211_disconnected(priv->netdev, 0, NULL, 0,
GFP_KERNEL);
break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
return mwifiex_send_cmd_sync(priv, return mwifiex_send_cmd_sync(priv,
HostCmd_CMD_802_11_AD_HOC_STOP, HostCmd_CMD_802_11_AD_HOC_STOP,
...@@ -1440,7 +1446,7 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac) ...@@ -1440,7 +1446,7 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
break; break;
} }
return 0; return ret;
} }
EXPORT_SYMBOL_GPL(mwifiex_deauthenticate); EXPORT_SYMBOL_GPL(mwifiex_deauthenticate);
......
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