summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorWen Huang <huangwenabc@gmail.com>2019-08-27 22:07:51 -0400
committerKalle Valo <kvalo@codeaurora.org>2019-09-03 09:50:21 -0400
commit7caac62ed598a196d6ddf8d9c121e12e082cac3a (patch)
tree926f8c0a3bb5c8cff8ee3a1d5d8a4a85e94e853b /drivers/net/wireless
parent70702265a04aa0ce5a7bde77d13456209992b32f (diff)
mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings
mwifiex_update_vs_ie(),mwifiex_set_uap_rates() and mwifiex_set_wmm_params() call memcpy() without checking the destination size.Since the source is given from user-space, this may trigger a heap buffer overflow. Fix them by putting the length check before performing memcpy(). This fix addresses CVE-2019-14814,CVE-2019-14815,CVE-2019-14816. Signed-off-by: Wen Huang <huangwenabc@gmail.com> Acked-by: Ganapathi Bhat <gbhat@marvell.comg> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/marvell/mwifiex/ie.c3
-rw-r--r--drivers/net/wireless/marvell/mwifiex/uap_cmd.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/ie.c b/drivers/net/wireless/marvell/mwifiex/ie.c
index 653d347a9a19..580387f9f12a 100644
--- a/drivers/net/wireless/marvell/mwifiex/ie.c
+++ b/drivers/net/wireless/marvell/mwifiex/ie.c
@@ -241,6 +241,9 @@ static int mwifiex_update_vs_ie(const u8 *ies, int ies_len,
241 } 241 }
242 242
243 vs_ie = (struct ieee_types_header *)vendor_ie; 243 vs_ie = (struct ieee_types_header *)vendor_ie;
244 if (le16_to_cpu(ie->ie_length) + vs_ie->len + 2 >
245 IEEE_MAX_IE_SIZE)
246 return -EINVAL;
244 memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length), 247 memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length),
245 vs_ie, vs_ie->len + 2); 248 vs_ie, vs_ie->len + 2);
246 le16_unaligned_add_cpu(&ie->ie_length, vs_ie->len + 2); 249 le16_unaligned_add_cpu(&ie->ie_length, vs_ie->len + 2);
diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
index 18f7d9bf30b2..0939a8c8f3ab 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
@@ -265,6 +265,8 @@ mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
265 265
266 rate_ie = (void *)cfg80211_find_ie(WLAN_EID_SUPP_RATES, var_pos, len); 266 rate_ie = (void *)cfg80211_find_ie(WLAN_EID_SUPP_RATES, var_pos, len);
267 if (rate_ie) { 267 if (rate_ie) {
268 if (rate_ie->len > MWIFIEX_SUPPORTED_RATES)
269 return;
268 memcpy(bss_cfg->rates, rate_ie + 1, rate_ie->len); 270 memcpy(bss_cfg->rates, rate_ie + 1, rate_ie->len);
269 rate_len = rate_ie->len; 271 rate_len = rate_ie->len;
270 } 272 }
@@ -272,8 +274,11 @@ mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
272 rate_ie = (void *)cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES, 274 rate_ie = (void *)cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES,
273 params->beacon.tail, 275 params->beacon.tail,
274 params->beacon.tail_len); 276 params->beacon.tail_len);
275 if (rate_ie) 277 if (rate_ie) {
278 if (rate_ie->len > MWIFIEX_SUPPORTED_RATES - rate_len)
279 return;
276 memcpy(bss_cfg->rates + rate_len, rate_ie + 1, rate_ie->len); 280 memcpy(bss_cfg->rates + rate_len, rate_ie + 1, rate_ie->len);
281 }
277 282
278 return; 283 return;
279} 284}
@@ -391,6 +396,8 @@ mwifiex_set_wmm_params(struct mwifiex_private *priv,
391 params->beacon.tail_len); 396 params->beacon.tail_len);
392 if (vendor_ie) { 397 if (vendor_ie) {
393 wmm_ie = vendor_ie; 398 wmm_ie = vendor_ie;
399 if (*(wmm_ie + 1) > sizeof(struct mwifiex_types_wmm_info))
400 return;
394 memcpy(&bss_cfg->wmm_info, wmm_ie + 401 memcpy(&bss_cfg->wmm_info, wmm_ie +
395 sizeof(struct ieee_types_header), *(wmm_ie + 1)); 402 sizeof(struct ieee_types_header), *(wmm_ie + 1));
396 priv->wmm_enabled = 1; 403 priv->wmm_enabled = 1;