Commit 5d1ec85f authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: dont try to use existing sta for AP

Clean out some cruft that could use an already existing
sta_info struct -- that case cannot happen. Also, there's
a bug there -- if allocation/insertion fails then it is
possible that we are left in a lingering state where
mac80211 waits for the AP, cfg80211 waits for mac80211,
but the AP has already replied. Since there's no way to
indicate an internal error, pretend there was a timeout,
i.e. that the AP never responded.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5fba4af3
...@@ -75,6 +75,9 @@ enum rx_mgmt_action { ...@@ -75,6 +75,9 @@ enum rx_mgmt_action {
/* caller must call cfg80211_send_disassoc() */ /* caller must call cfg80211_send_disassoc() */
RX_MGMT_CFG80211_DISASSOC, RX_MGMT_CFG80211_DISASSOC,
/* caller must tell cfg80211 about internal error */
RX_MGMT_CFG80211_ASSOC_ERROR,
/* caller must call cfg80211_auth_timeout() & free work */ /* caller must call cfg80211_auth_timeout() & free work */
RX_MGMT_CFG80211_AUTH_TO, RX_MGMT_CFG80211_AUTH_TO,
...@@ -1479,8 +1482,8 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1479,8 +1482,8 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
u8 *pos; u8 *pos;
u32 changed = 0; u32 changed = 0;
int i, j; int i, j, err;
bool have_higher_than_11mbit = false, newsta = false; bool have_higher_than_11mbit = false;
u16 ap_ht_cap_flags; u16 ap_ht_cap_flags;
/* /*
...@@ -1542,20 +1545,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1542,20 +1545,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
printk(KERN_DEBUG "%s: associated\n", sdata->name); printk(KERN_DEBUG "%s: associated\n", sdata->name);
ifmgd->aid = aid; ifmgd->aid = aid;
rcu_read_lock();
/* Add STA entry for the AP */
sta = sta_info_get(sdata, wk->bss->cbss.bssid);
if (!sta) {
newsta = true;
rcu_read_unlock();
sta = sta_info_alloc(sdata, wk->bss->cbss.bssid, GFP_KERNEL); sta = sta_info_alloc(sdata, wk->bss->cbss.bssid, GFP_KERNEL);
if (!sta) { if (!sta) {
printk(KERN_DEBUG "%s: failed to alloc STA entry for" printk(KERN_DEBUG "%s: failed to alloc STA entry for"
" the AP\n", sdata->name); " the AP\n", sdata->name);
return RX_MGMT_NONE; return RX_MGMT_CFG80211_ASSOC_ERROR;
} }
set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC |
...@@ -1563,9 +1557,6 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1563,9 +1557,6 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
set_sta_flags(sta, WLAN_STA_AUTHORIZED); set_sta_flags(sta, WLAN_STA_AUTHORIZED);
rcu_read_lock();
}
rates = 0; rates = 0;
basic_rates = 0; basic_rates = 0;
sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
...@@ -1628,17 +1619,13 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -1628,17 +1619,13 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
if (elems.wmm_param) if (elems.wmm_param)
set_sta_flags(sta, WLAN_STA_WME); set_sta_flags(sta, WLAN_STA_WME);
if (newsta) { err = sta_info_insert(sta);
int err = sta_info_insert(sta); sta = NULL;
if (err) { if (err) {
printk(KERN_DEBUG "%s: failed to insert STA entry for" printk(KERN_DEBUG "%s: failed to insert STA entry for"
" the AP (error %d)\n", sdata->name, err); " the AP (error %d)\n", sdata->name, err);
rcu_read_unlock(); return RX_MGMT_CFG80211_ASSOC_ERROR;
return RX_MGMT_NONE;
} }
}
rcu_read_unlock();
if (elems.wmm_param) if (elems.wmm_param)
ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param,
...@@ -2084,6 +2071,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, ...@@ -2084,6 +2071,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
case RX_MGMT_CFG80211_DEAUTH: case RX_MGMT_CFG80211_DEAUTH:
cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len); cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
break; break;
case RX_MGMT_CFG80211_ASSOC_ERROR:
/* an internal error -- pretend timeout for now */
cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid);
break;
default: default:
WARN(1, "unexpected: %d", rma); WARN(1, "unexpected: %d", rma);
} }
......
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