diff mbox series

[X,2/3] UBUNTU: SAUCE: libertas: Fix two buffer overflows at parsing bss descriptor

Message ID 20191126083917.5995-6-stefan.bader@canonical.com
State New
Headers show
Series Multiple buffer overflows in Marvell driver | expand

Commit Message

Stefan Bader Nov. 26, 2019, 8:39 a.m. UTC
From: Wen Huang <huangwenabc@gmail.com>

add_ie_rates() copys rates without checking the length
in bss descriptor from remote AP.when victim connects to
remote attacker, this may trigger buffer overflow.
lbs_ibss_join_existing() copys rates without checking the length
in bss descriptor from remote IBSS node.when victim connects to
remote attacker, this may trigger buffer overflow.
Fix them by putting the length check before performing copy.

This fix addresses CVE-2019-14896 and CVE-2019-14897.

Signed-off-by: Wen Huang <huangwenabc@gmail.com>

CVE-2019-14896
CVE-2019-14897

(backported from https://patchwork.kernel.org/patch/11257187/)
[smb: drop marvell subdirectory from path]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 drivers/net/wireless/libertas/cfg.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 8317afd065b4..0787b1a309b5 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -272,6 +272,10 @@  add_ie_rates(u8 *tlv, const u8 *ie, int *nrates)
 	int hw, ap, ap_max = ie[1];
 	u8 hw_rate;
 
+	if (ap_max > MAX_RATES) {
+		lbs_deb_assoc("invalid rates\n");
+		return tlv;
+	}
 	/* Advance past IE header */
 	ie += 2;
 
@@ -1845,6 +1849,10 @@  static int lbs_ibss_join_existing(struct lbs_private *priv,
 	} else {
 		int hw, i;
 		u8 rates_max = rates_eid[1];
+		if (rates_max > MAX_RATES) {
+			lbs_deb_join("invalid rates");
+			goto out;
+		}
 		u8 *rates = cmd.bss.rates;
 		for (hw = 0; hw < ARRAY_SIZE(lbs_rates); hw++) {
 			u8 hw_rate = lbs_rates[hw].bitrate / 5;