Skip to content

Commit 1c656ff

Browse files
Wen HuangBrian Maly
authored andcommitted
mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings
commit 7caac62 upstream. 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 <[email protected]> Acked-by: Ganapathi Bhat <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Orabug: 31104481 CVE: CVE-2019-14814 CVE: CVE-2019-14815 CVE: CVE-2019-14816 (cherry picked from commit 851224e62b5525f0a87a171905e5c144e1899cd2) Signed-off-by: Dan Duval <[email protected]> Reviewed-by: Larry Bassel <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent fc2329c commit 1c656ff

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/net/wireless/mwifiex/ie.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ static int mwifiex_update_vs_ie(const u8 *ies, int ies_len,
240240
}
241241

242242
vs_ie = (struct ieee_types_header *)vendor_ie;
243+
if (le16_to_cpu(ie->ie_length) + vs_ie->len + 2 >
244+
IEEE_MAX_IE_SIZE)
245+
return -EINVAL;
243246
memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length),
244247
vs_ie, vs_ie->len + 2);
245248
le16_add_cpu(&ie->ie_length, vs_ie->len + 2);

drivers/net/wireless/mwifiex/uap_cmd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,20 @@ mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
269269

270270
rate_ie = (void *)cfg80211_find_ie(WLAN_EID_SUPP_RATES, var_pos, len);
271271
if (rate_ie) {
272+
if (rate_ie->len > MWIFIEX_SUPPORTED_RATES)
273+
return;
272274
memcpy(bss_cfg->rates, rate_ie + 1, rate_ie->len);
273275
rate_len = rate_ie->len;
274276
}
275277

276278
rate_ie = (void *)cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES,
277279
params->beacon.tail,
278280
params->beacon.tail_len);
279-
if (rate_ie)
281+
if (rate_ie) {
282+
if (rate_ie->len > MWIFIEX_SUPPORTED_RATES - rate_len)
283+
return;
280284
memcpy(bss_cfg->rates + rate_len, rate_ie + 1, rate_ie->len);
285+
}
281286

282287
return;
283288
}
@@ -395,6 +400,8 @@ mwifiex_set_wmm_params(struct mwifiex_private *priv,
395400
params->beacon.tail_len);
396401
if (vendor_ie) {
397402
wmm_ie = (struct ieee_types_header *)vendor_ie;
403+
if (*(vendor_ie + 1) > sizeof(struct mwifiex_types_wmm_info))
404+
return;
398405
memcpy(&bss_cfg->wmm_info, wmm_ie + 1,
399406
sizeof(bss_cfg->wmm_info));
400407
priv->wmm_enabled = 1;

0 commit comments

Comments
 (0)