Skip to content

Commit 7caac62

Browse files
Wen HuangKalle Valo
authored andcommitted
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 <[email protected]> Acked-by: Ganapathi Bhat <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 7070226 commit 7caac62

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/net/wireless/marvell/mwifiex/ie.c

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

243243
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;
244247
memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length),
245248
vs_ie, vs_ie->len + 2);
246249
le16_unaligned_add_cpu(&ie->ie_length, vs_ie->len + 2);

drivers/net/wireless/marvell/mwifiex/uap_cmd.c

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

266266
rate_ie = (void *)cfg80211_find_ie(WLAN_EID_SUPP_RATES, var_pos, len);
267267
if (rate_ie) {
268+
if (rate_ie->len > MWIFIEX_SUPPORTED_RATES)
269+
return;
268270
memcpy(bss_cfg->rates, rate_ie + 1, rate_ie->len);
269271
rate_len = rate_ie->len;
270272
}
271273

272274
rate_ie = (void *)cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES,
273275
params->beacon.tail,
274276
params->beacon.tail_len);
275-
if (rate_ie)
277+
if (rate_ie) {
278+
if (rate_ie->len > MWIFIEX_SUPPORTED_RATES - rate_len)
279+
return;
276280
memcpy(bss_cfg->rates + rate_len, rate_ie + 1, rate_ie->len);
281+
}
277282

278283
return;
279284
}
@@ -391,6 +396,8 @@ mwifiex_set_wmm_params(struct mwifiex_private *priv,
391396
params->beacon.tail_len);
392397
if (vendor_ie) {
393398
wmm_ie = vendor_ie;
399+
if (*(wmm_ie + 1) > sizeof(struct mwifiex_types_wmm_info))
400+
return;
394401
memcpy(&bss_cfg->wmm_info, wmm_ie +
395402
sizeof(struct ieee_types_header), *(wmm_ie + 1));
396403
priv->wmm_enabled = 1;

0 commit comments

Comments
 (0)