Skip to content

Commit ddf4ac5

Browse files
jmberglinvjw
authored andcommitted
mac80211: insert AP sta entry after filling it
We never clearly defined the semantics of the sta_notify callback and it was originally posted for iwlwifi which still doesn't use it at all. With the recent HT rework ath9k started relying on it, but I made a mistake there in that I made ath9k assume the HT information has already been filled in at sta_notify time. This isn't a hard thing to do, so do it. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent cfa3fa4 commit ddf4ac5

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

‎net/mac80211/mlme.c‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
11821182
u8 *pos;
11831183
u32 changed = 0;
11841184
int i, j;
1185-
bool have_higher_than_11mbit = false;
1185+
bool have_higher_than_11mbit = false, newsta = false;
11861186
u16 ap_ht_cap_flags;
11871187

11881188
/* AssocResp and ReassocResp have identical structure, so process both
@@ -1246,7 +1246,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
12461246
sta = sta_info_get(local, ifsta->bssid);
12471247
if (!sta) {
12481248
struct ieee80211_bss *bss;
1249-
int err;
1249+
1250+
newsta = true;
12501251

12511252
sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC);
12521253
if (!sta) {
@@ -1265,13 +1266,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
12651266
ieee80211_rx_bss_put(local, bss);
12661267
}
12671268

1268-
err = sta_info_insert(sta);
1269-
if (err) {
1270-
printk(KERN_DEBUG "%s: failed to insert STA entry for"
1271-
" the AP (error %d)\n", sdata->dev->name, err);
1272-
rcu_read_unlock();
1273-
return;
1274-
}
12751269
/* update new sta with its last rx activity */
12761270
sta->last_rx = jiffies;
12771271
}
@@ -1339,13 +1333,24 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
13391333

13401334
rate_control_rate_init(sta);
13411335

1342-
if (elems.wmm_param) {
1336+
if (elems.wmm_param)
13431337
set_sta_flags(sta, WLAN_STA_WME);
1344-
rcu_read_unlock();
1338+
1339+
if (newsta) {
1340+
int err = sta_info_insert(sta);
1341+
if (err) {
1342+
printk(KERN_DEBUG "%s: failed to insert STA entry for"
1343+
" the AP (error %d)\n", sdata->dev->name, err);
1344+
rcu_read_unlock();
1345+
return;
1346+
}
1347+
}
1348+
1349+
rcu_read_unlock();
1350+
1351+
if (elems.wmm_param)
13451352
ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param,
13461353
elems.wmm_param_len);
1347-
} else
1348-
rcu_read_unlock();
13491354

13501355
if (elems.ht_info_elem && elems.wmm_param &&
13511356
(ifsta->flags & IEEE80211_STA_WMM_ENABLED))

0 commit comments

Comments
 (0)