hostapd: fix a race condition related to assoc response tx status processing
[openwrt/openwrt.git] / package / hostapd / patches / 740-process_assoc_resp_tx_status.patch
1 --- a/src/ap/ieee802_11.c
2 +++ b/src/ap/ieee802_11.c
3 @@ -1629,13 +1629,6 @@ static void handle_assoc_cb(struct hosta
4 int new_assoc = 1;
5 struct ieee80211_ht_capabilities ht_cap;
6
7 - if (!ok) {
8 - hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
9 - HOSTAPD_LEVEL_DEBUG,
10 - "did not acknowledge association response");
11 - return;
12 - }
13 -
14 if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_resp) :
15 sizeof(mgmt->u.assoc_resp))) {
16 printf("handle_assoc_cb(reassoc=%d) - too short payload "
17 @@ -1643,11 +1636,6 @@ static void handle_assoc_cb(struct hosta
18 return;
19 }
20
21 - if (reassoc)
22 - status = le_to_host16(mgmt->u.reassoc_resp.status_code);
23 - else
24 - status = le_to_host16(mgmt->u.assoc_resp.status_code);
25 -
26 sta = ap_get_sta(hapd, mgmt->da);
27 if (!sta) {
28 printf("handle_assoc_cb: STA " MACSTR " not found\n",
29 @@ -1655,6 +1643,19 @@ static void handle_assoc_cb(struct hosta
30 return;
31 }
32
33 + if (!ok) {
34 + hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
35 + HOSTAPD_LEVEL_DEBUG,
36 + "did not acknowledge association response");
37 + sta->flags &= ~WLAN_STA_ASSOC_REQ_OK;
38 + return;
39 + }
40 +
41 + if (reassoc)
42 + status = le_to_host16(mgmt->u.reassoc_resp.status_code);
43 + else
44 + status = le_to_host16(mgmt->u.assoc_resp.status_code);
45 +
46 if (status != WLAN_STATUS_SUCCESS)
47 goto fail;
48