From: Johannes Berg These don't need to be stored in the interface, they can be stored in the assoc data. Signed-off-by: Johannes Berg --- net/mac80211/ieee80211_i.h | 10 ++++------ net/mac80211/mlme.c | 17 ++++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 80d9d6233df9..fc75a2e98959 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -508,6 +508,10 @@ struct ieee80211_mgd_assoc_data { u8 fils_kek[FILS_MAX_KEK_LEN]; size_t fils_kek_len; + /* separately allocated, needs to be freed */ + u8 *req_elems; + size_t req_elems_len; + size_t ie_len; u8 *ie_pos; /* used to fill ie[] with link[].elems */ u8 ie[]; @@ -631,12 +635,6 @@ struct ieee80211_if_managed { */ struct wiphy_delayed_work tx_tspec_wk; - /* Information elements from the last transmitted (Re)Association - * Request frame. - */ - u8 *assoc_req_ies; - size_t assoc_req_ies_len; - struct wiphy_hrtimer_work ml_reconf_work; u16 removed_links; diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 8081f0547434..6e9dea7b0373 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -2830,14 +2830,15 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) } pos = skb_tail_pointer(skb); - kfree(ifmgd->assoc_req_ies); - ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); - if (!ifmgd->assoc_req_ies) { + /* might already exist (on retry) */ + kfree(assoc_data->req_elems); + assoc_data->req_elems = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC); + if (!assoc_data->req_elems) { dev_kfree_skb(skb); return -ENOMEM; } - ifmgd->assoc_req_ies_len = pos - ie_start; + assoc_data->req_elems_len = pos - ie_start; info.link_id = assoc_data->assoc_link_id; drv_mgd_prepare_tx(local, sdata, &info); @@ -5437,6 +5438,7 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata, ieee80211_vif_set_links(sdata, 0, 0); } + kfree(assoc_data->req_elems); kfree(assoc_data); } @@ -7561,8 +7563,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, resp.buf = (u8 *)mgmt; resp.len = len; - resp.req_ies = ifmgd->assoc_req_ies; - resp.req_ies_len = ifmgd->assoc_req_ies_len; + resp.req_ies = assoc_data->req_elems; + resp.req_ies_len = assoc_data->req_elems_len; cfg80211_rx_assoc_resp(sdata->dev, &resp); assoc_status = status_code == WLAN_STATUS_SUCCESS ? ASSOC_SUCCESS : ASSOC_REJECTED; @@ -11011,9 +11013,6 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) ifmgd->teardown_skb = NULL; ifmgd->orig_teardown_skb = NULL; } - kfree(ifmgd->assoc_req_ies); - ifmgd->assoc_req_ies = NULL; - ifmgd->assoc_req_ies_len = 0; spin_unlock_bh(&ifmgd->teardown_lock); timer_delete_sync(&ifmgd->timer); } -- 2.56.0