netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.14 01/57] mwifiex: fix possible heap overflow in mwifiex_process_country_ie()
@ 2019-12-27 18:01 Sasha Levin
  2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 03/57] netfilter: ctnetlink: netns exit must wait for callbacks Sasha Levin
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: Sasha Levin @ 2019-12-27 18:01 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ganapathi Bhat, huangwen, Kalle Valo, Sasha Levin, linux-wireless,
	netdev

From: Ganapathi Bhat <gbhat@marvell.com>

[ Upstream commit 3d94a4a8373bf5f45cf5f939e88b8354dbf2311b ]

mwifiex_process_country_ie() function parse elements of bss
descriptor in beacon packet. When processing WLAN_EID_COUNTRY
element, there is no upper limit check for country_ie_len before
calling memcpy. The destination buffer domain_info->triplet is an
array of length MWIFIEX_MAX_TRIPLET_802_11D(83). The remote
attacker can build a fake AP with the same ssid as real AP, and
send malicous beacon packet with long WLAN_EID_COUNTRY elemen
(country_ie_len > 83). Attacker can  force STA connect to fake AP
on a different channel. When the victim STA connects to fake AP,
will trigger the heap buffer overflow. Fix this by checking for
length and if found invalid, don not connect to the AP.

This fix addresses CVE-2019-14895.

Reported-by: huangwen <huangwenabc@gmail.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index a8043d76152a..f88a953b3cd5 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -271,6 +271,14 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv,
 			    "11D: skip setting domain info in FW\n");
 		return 0;
 	}
+
+	if (country_ie_len >
+	    (IEEE80211_COUNTRY_STRING_LEN + MWIFIEX_MAX_TRIPLET_802_11D)) {
+		mwifiex_dbg(priv->adapter, ERROR,
+			    "11D: country_ie_len overflow!, deauth AP\n");
+		return -EINVAL;
+	}
+
 	memcpy(priv->adapter->country_code, &country_ie[2], 2);
 
 	domain_info->country_code[0] = country_ie[2];
@@ -314,8 +322,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 	priv->scan_block = false;
 
 	if (bss) {
-		if (adapter->region_code == 0x00)
-			mwifiex_process_country_ie(priv, bss);
+		if (adapter->region_code == 0x00 &&
+		    mwifiex_process_country_ie(priv, bss))
+			return -EINVAL;
 
 		/* Allocate and fill new bss descriptor */
 		bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2019-12-27 18:07 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-27 18:01 [PATCH AUTOSEL 4.14 01/57] mwifiex: fix possible heap overflow in mwifiex_process_country_ie() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 03/57] netfilter: ctnetlink: netns exit must wait for callbacks Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 04/57] mwifiex: Fix heap overflow in mmwifiex_process_tdls_action_frame() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 07/57] netfilter: nf_queue: enqueue skbs with NULL dst Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 13/57] netfilter: nf_tables: validate NFT_SET_ELEM_INTERVAL_END Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 14/57] netfilter: bridge: make sure to pull arp header in br_nf_forward_arp() Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 17/57] af_packet: set defaule value for tmo Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 18/57] fjes: fix missed check in fjes_acpi_add Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 21/57] net: ena: fix napi handler misbehavior when the napi budget is zero Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 22/57] bpf, mips: Limit to 33 tail calls Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 24/57] samples: bpf: Replace symbol compare of trace_event Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 25/57] samples: bpf: fix syscall_tp due to unused syscall Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 27/57] net: usb: lan78xx: Fix suspend/resume PHY register access error Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 28/57] qede: Fix multicast mac configuration Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 30/57] 6pack,mkiss: fix possible deadlock Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 31/57] bnx2x: Do not handle requests from VFs after parity Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 32/57] bnx2x: Fix logic to get total no. of PFs per engine Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 33/57] bonding: fix active-backup transition after link failure Sasha Levin
2019-12-27 18:01 ` [PATCH AUTOSEL 4.14 34/57] gtp: do not allow adding duplicate tid and ms_addr pdp context Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 35/57] gtp: fix wrong condition in gtp_genl_dump_pdp() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 36/57] gtp: avoid zero size hashtable Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 37/57] net: usb: lan78xx: Fix error message format specifier Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 38/57] rfkill: Fix incorrect check to avoid NULL pointer dereference Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 45/57] net: qlogic: Fix error paths in ql_alloc_large_buffers() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 46/57] net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 47/57] net: stmmac: Do not accept invalid MTU values Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 48/57] net: stmmac: RX buffer size must be 16 byte aligned Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 49/57] net, sysctl: Fix compiler warning when only cBPF is present Sasha Levin
2019-12-27 18:02 ` [PATCH AUTOSEL 4.14 54/57] net: hisilicon: Fix a BUG trigered by wrong bytes_compl Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).