summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2018-10-30 04:17:45 -0400
committerJohannes Berg <johannes.berg@intel.com>2018-11-09 02:57:40 -0500
commit03b738625b1e58f4ae2bddf04706ab85c677af2d (patch)
tree78f4a7bbf918086d214f5ddb5b2e1a81059b056f /net
parentc177db2d0d5e751d52d3827b8cfdb6ef92a95a2d (diff)
mac80211: fix CSA beacon allocation size
If the FTM responder settings are changed simultaneously with the CSA beacon, the buffer size allocated isn't sufficient and we'll have a heap overrun. Fix this. While at it, also clean up the ftm_responder assignment, doing it only if ftm_responder is non-zero is valid as it's 0 to start with, but not really useful to understand the code. Fixes: bc847970f432 ("mac80211: support FTM responder configuration/statistics") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 51622333d460..818aa0060349 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2891,7 +2891,7 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
2891 2891
2892 len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len + 2892 len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len +
2893 beacon->proberesp_ies_len + beacon->assocresp_ies_len + 2893 beacon->proberesp_ies_len + beacon->assocresp_ies_len +
2894 beacon->probe_resp_len; 2894 beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len;
2895 2895
2896 new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL); 2896 new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL);
2897 if (!new_beacon) 2897 if (!new_beacon)
@@ -2934,8 +2934,9 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
2934 memcpy(pos, beacon->probe_resp, beacon->probe_resp_len); 2934 memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);
2935 pos += beacon->probe_resp_len; 2935 pos += beacon->probe_resp_len;
2936 } 2936 }
2937 if (beacon->ftm_responder) 2937
2938 new_beacon->ftm_responder = beacon->ftm_responder; 2938 /* might copy -1, meaning no changes requested */
2939 new_beacon->ftm_responder = beacon->ftm_responder;
2939 if (beacon->lci) { 2940 if (beacon->lci) {
2940 new_beacon->lci_len = beacon->lci_len; 2941 new_beacon->lci_len = beacon->lci_len;
2941 new_beacon->lci = pos; 2942 new_beacon->lci = pos;