Commit 5e13fd35 authored by Vasanthakumar Thiagarajan's avatar Vasanthakumar Thiagarajan Committed by Kalle Valo

ath6kl: Use cfg80211_roamed_bss() to report roaming event

This is to avoid the scenario where the bss entry of the AP got
expired when reporting roaming event to current AP. As the bss
entry for the current bss is available in driver, pass this bss
to cfg80211. This fixes WARNING: at net/wireless/sme.c:586.

This patch depends on the following patch in cfg80211
"cfg80211: Fix race in bss timeout".
Reported-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: default avatarVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 7e95e365
...@@ -605,11 +605,13 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -605,11 +605,13 @@ static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
return 0; return 0;
} }
static int ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, static struct cfg80211_bss *
enum network_type nw_type, ath6kl_add_bss_if_needed(struct ath6kl_vif *vif,
const u8 *bssid, enum network_type nw_type,
struct ieee80211_channel *chan, const u8 *bssid,
const u8 *beacon_ie, size_t beacon_ie_len) struct ieee80211_channel *chan,
const u8 *beacon_ie,
size_t beacon_ie_len)
{ {
struct ath6kl *ar = vif->ar; struct ath6kl *ar = vif->ar;
struct cfg80211_bss *bss; struct cfg80211_bss *bss;
...@@ -638,7 +640,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, ...@@ -638,7 +640,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl_vif *vif,
*/ */
ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL); ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL);
if (ie == NULL) if (ie == NULL)
return -ENOMEM; return NULL;
ie[0] = WLAN_EID_SSID; ie[0] = WLAN_EID_SSID;
ie[1] = vif->ssid_len; ie[1] = vif->ssid_len;
memcpy(ie + 2, vif->ssid, vif->ssid_len); memcpy(ie + 2, vif->ssid, vif->ssid_len);
...@@ -652,15 +654,9 @@ static int ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, ...@@ -652,15 +654,9 @@ static int ath6kl_add_bss_if_needed(struct ath6kl_vif *vif,
"cfg80211\n", bssid); "cfg80211\n", bssid);
kfree(ie); kfree(ie);
} else } else
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss " ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss\n");
"entry\n");
if (bss == NULL)
return -ENOMEM;
cfg80211_put_bss(bss); return bss;
return 0;
} }
void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
...@@ -672,6 +668,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, ...@@ -672,6 +668,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
{ {
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
struct ath6kl *ar = vif->ar; struct ath6kl *ar = vif->ar;
struct cfg80211_bss *bss;
/* capinfo + listen interval */ /* capinfo + listen interval */
u8 assoc_req_ie_offset = sizeof(u16) + sizeof(u16); u8 assoc_req_ie_offset = sizeof(u16) + sizeof(u16);
...@@ -712,8 +709,9 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, ...@@ -712,8 +709,9 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
chan = ieee80211_get_channel(ar->wiphy, (int) channel); chan = ieee80211_get_channel(ar->wiphy, (int) channel);
if (ath6kl_add_bss_if_needed(vif, nw_type, bssid, chan, assoc_info, bss = ath6kl_add_bss_if_needed(vif, nw_type, bssid, chan,
beacon_ie_len) < 0) { assoc_info, beacon_ie_len);
if (!bss) {
ath6kl_err("could not add cfg80211 bss entry\n"); ath6kl_err("could not add cfg80211 bss entry\n");
return; return;
} }
...@@ -722,6 +720,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, ...@@ -722,6 +720,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "ad-hoc %s selected\n", ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "ad-hoc %s selected\n",
nw_type & ADHOC_CREATOR ? "creator" : "joiner"); nw_type & ADHOC_CREATOR ? "creator" : "joiner");
cfg80211_ibss_joined(vif->ndev, bssid, GFP_KERNEL); cfg80211_ibss_joined(vif->ndev, bssid, GFP_KERNEL);
cfg80211_put_bss(bss);
return; return;
} }
...@@ -732,11 +731,11 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, ...@@ -732,11 +731,11 @@ void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
assoc_req_ie, assoc_req_len, assoc_req_ie, assoc_req_len,
assoc_resp_ie, assoc_resp_len, assoc_resp_ie, assoc_resp_len,
WLAN_STATUS_SUCCESS, GFP_KERNEL); WLAN_STATUS_SUCCESS, GFP_KERNEL);
cfg80211_put_bss(bss);
} else if (vif->sme_state == SME_CONNECTED) { } else if (vif->sme_state == SME_CONNECTED) {
/* inform roam event to cfg80211 */ /* inform roam event to cfg80211 */
cfg80211_roamed(vif->ndev, chan, bssid, cfg80211_roamed_bss(vif->ndev, bss, assoc_req_ie, assoc_req_len,
assoc_req_ie, assoc_req_len, assoc_resp_ie, assoc_resp_len, GFP_KERNEL);
assoc_resp_ie, assoc_resp_len, GFP_KERNEL);
} }
} }
......
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