aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d779c57a8220..aca22b00b6a3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1102,14 +1102,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1102 struct sta_info *sta; 1102 struct sta_info *sta;
1103 u32 changed = 0, config_changed = 0; 1103 u32 changed = 0, config_changed = 0;
1104 1104
1105 rcu_read_lock();
1106
1107 sta = sta_info_get(local, ifmgd->bssid);
1108 if (!sta) {
1109 rcu_read_unlock();
1110 return;
1111 }
1112
1113 if (deauth) { 1105 if (deauth) {
1114 ifmgd->direct_probe_tries = 0; 1106 ifmgd->direct_probe_tries = 0;
1115 ifmgd->auth_tries = 0; 1107 ifmgd->auth_tries = 0;
@@ -1120,7 +1112,11 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1120 netif_tx_stop_all_queues(sdata->dev); 1112 netif_tx_stop_all_queues(sdata->dev);
1121 netif_carrier_off(sdata->dev); 1113 netif_carrier_off(sdata->dev);
1122 1114
1123 ieee80211_sta_tear_down_BA_sessions(sta); 1115 rcu_read_lock();
1116 sta = sta_info_get(local, ifmgd->bssid);
1117 if (sta)
1118 ieee80211_sta_tear_down_BA_sessions(sta);
1119 rcu_read_unlock();
1124 1120
1125 bss = ieee80211_rx_bss_get(local, ifmgd->bssid, 1121 bss = ieee80211_rx_bss_get(local, ifmgd->bssid,
1126 conf->channel->center_freq, 1122 conf->channel->center_freq,
@@ -1156,8 +1152,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1156 ifmgd->ssid, ifmgd->ssid_len); 1152 ifmgd->ssid, ifmgd->ssid_len);
1157 } 1153 }
1158 1154
1159 rcu_read_unlock();
1160
1161 ieee80211_set_wmm_default(sdata); 1155 ieee80211_set_wmm_default(sdata);
1162 1156
1163 ieee80211_recalc_idle(local); 1157 ieee80211_recalc_idle(local);
@@ -2223,7 +2217,10 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata)
2223 capa_mask, capa_val); 2217 capa_mask, capa_val);
2224 2218
2225 if (bss) { 2219 if (bss) {
2226 ieee80211_set_freq(sdata, bss->cbss.channel->center_freq); 2220 local->oper_channel = bss->cbss.channel;
2221 local->oper_channel_type = NL80211_CHAN_NO_HT;
2222 ieee80211_hw_config(local, 0);
2223
2227 if (!(ifmgd->flags & IEEE80211_STA_SSID_SET)) 2224 if (!(ifmgd->flags & IEEE80211_STA_SSID_SET))
2228 ieee80211_sta_set_ssid(sdata, bss->ssid, 2225 ieee80211_sta_set_ssid(sdata, bss->ssid,
2229 bss->ssid_len); 2226 bss->ssid_len);
@@ -2445,6 +2442,14 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata)
2445 ieee80211_set_disassoc(sdata, true, true, 2442 ieee80211_set_disassoc(sdata, true, true,
2446 WLAN_REASON_DEAUTH_LEAVING); 2443 WLAN_REASON_DEAUTH_LEAVING);
2447 2444
2445 if (ifmgd->ssid_len == 0) {
2446 /*
2447 * Only allow association to be started if a valid SSID
2448 * is configured.
2449 */
2450 return;
2451 }
2452
2448 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) || 2453 if (!(ifmgd->flags & IEEE80211_STA_EXT_SME) ||
2449 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE) 2454 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE)
2450 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request); 2455 set_bit(IEEE80211_STA_REQ_AUTH, &ifmgd->request);
@@ -2476,6 +2481,10 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
2476 ifmgd = &sdata->u.mgd; 2481 ifmgd = &sdata->u.mgd;
2477 2482
2478 if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) { 2483 if (ifmgd->ssid_len != len || memcmp(ifmgd->ssid, ssid, len) != 0) {
2484 if (ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2485 ieee80211_set_disassoc(sdata, true, true,
2486 WLAN_REASON_DEAUTH_LEAVING);
2487
2479 /* 2488 /*
2480 * Do not use reassociation if SSID is changed (different ESS). 2489 * Do not use reassociation if SSID is changed (different ESS).
2481 */ 2490 */
@@ -2500,6 +2509,11 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
2500{ 2509{
2501 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2510 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2502 2511
2512 if (compare_ether_addr(bssid, ifmgd->bssid) != 0 &&
2513 ifmgd->state == IEEE80211_STA_MLME_ASSOCIATED)
2514 ieee80211_set_disassoc(sdata, true, true,
2515 WLAN_REASON_DEAUTH_LEAVING);
2516
2503 if (is_valid_ether_addr(bssid)) { 2517 if (is_valid_ether_addr(bssid)) {
2504 memcpy(ifmgd->bssid, bssid, ETH_ALEN); 2518 memcpy(ifmgd->bssid, bssid, ETH_ALEN);
2505 ifmgd->flags |= IEEE80211_STA_BSSID_SET; 2519 ifmgd->flags |= IEEE80211_STA_BSSID_SET;