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

mwifiex: check for bss_role instead of bss_mode for STA operations

This patch fixes an issue wherein association would fail on P2P
interfaces. This happened because we are checking priv->mode
against NL80211_IFTYPE_STATION. While this check is correct for
infrastructure stations, it would fail P2P clients for which mode
is NL80211_IFTYPE_P2P_CLIENT.

Better check would be bss_role which has only 2 values: STA/AP.

Cc: <stable@vger.kernel.org> # 3.10.y
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarStone Piao <piaoyun@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 161915a0
...@@ -1716,9 +1716,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -1716,9 +1716,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
int ret; int ret;
if (priv->bss_mode != NL80211_IFTYPE_STATION) { if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) {
wiphy_err(wiphy, wiphy_err(wiphy,
"%s: reject infra assoc request in non-STA mode\n", "%s: reject infra assoc request in non-STA role\n",
dev->name); dev->name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1291,8 +1291,10 @@ int mwifiex_associate(struct mwifiex_private *priv, ...@@ -1291,8 +1291,10 @@ int mwifiex_associate(struct mwifiex_private *priv,
{ {
u8 current_bssid[ETH_ALEN]; u8 current_bssid[ETH_ALEN];
/* Return error if the adapter or table entry is not marked as infra */ /* Return error if the adapter is not STA role or table entry
if ((priv->bss_mode != NL80211_IFTYPE_STATION) || * is not marked as infra.
*/
if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) ||
(bss_desc->bss_mode != NL80211_IFTYPE_STATION)) (bss_desc->bss_mode != NL80211_IFTYPE_STATION))
return -1; return -1;
......
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