From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 414DF42B339; Thu, 16 Jul 2026 14:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211912; cv=none; b=XzIp8M+rJ9ym64b78JnFGjyHQLJff9d8RJAixlzo6etQRY+EqfVtt1XkaRyFNzjTe3vFYlcivBlrbe18Sc6TRT1ynjfVx6UYQ4koAGFZXQCwno27Xo+EOXmQmYTGfiW2mP4vzalKOOmNk7lznJcjOk5BYJYEE66Tazoj/xuuM6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211912; c=relaxed/simple; bh=9lJSf/oLKZKpy4/uoietxGTTERmOqriDsbrNu6c9fP4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EhjR5JP7MNIpNABu7l329HcH9F9OH5rX2ayeAfcoL2HBBMvZJLM447k8WdM2iIaBSPyu1rPtNb9JPqprYUvEXuz+nkJkH7zQM9LKFX4UoX2M71Xk4eoHiRy/efh9MnAX3PgUN1rGqWVYYNhmhnMymgFJDGLXJM7lHVZdaYkwvMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IeFMDXdb; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IeFMDXdb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 605A51F000E9; Thu, 16 Jul 2026 14:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784211910; bh=gdlgxXHbsv6ULLKtwCUQ6YS1LIFpTMWc5z47ytUx5oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IeFMDXdbSLl3Adf9/7fwpigrkvHDICmefzGtat45C3uKWIdy8MS5/03P/V+KM/IVD R0u3VYDO9l3H1Zav1e4SeykErD4UYdypvVAz9qTNqIiVAdR/OPlzPu/z0Z/qIrrRAM 5RXByWQbLIIEhRgTZZNdfcJFlGV2KvMvgj3AeKVU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Alexandru Hossu , Luka Gejak Subject: [PATCH 6.12 126/349] staging: rtl8723bs: fix OOB write in HT_caps_handler() Date: Thu, 16 Jul 2026 15:31:00 +0200 Message-ID: <20260716133036.176907224@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133033.287196923@linuxfoundation.org> References: <20260716133033.287196923@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandru Hossu commit f8001e1a516ba3b495728c65b61f799cbfad6bd0 upstream. HT_caps_handler() iterates pIE->length bytes and writes into HT_caps.u.HT_cap[], which is a fixed 26-byte array (sizeof struct HT_caps_element). Because pIE->length is a raw u8 from an over-the-air 802.11 AssocResponse frame and is never validated, a malicious AP can set it up to 255, causing up to 229 bytes of out-of-bounds writes into adjacent fields of struct mlme_ext_info. Truncate the iteration count to the size of HT_caps.u.HT_cap using umin() so that data from a longer-than-expected IE is silently ignored rather than written out of bounds, preserving interoperability with APs that pad the element. An early return on oversized IEs was considered but rejected: it would bypass the pmlmeinfo->HT_caps_enable = 1 assignment that precedes the loop, silently disabling HT mode for APs that append extra bytes to the HT Capabilities IE. Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable Signed-off-by: Alexandru Hossu Reviewed-by: Luka Gejak Link: https://patch.msgid.link/20260522004531.1038924-5-hossu.alexandru@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c @@ -978,7 +978,8 @@ void HT_caps_handler(struct adapter *pad pmlmeinfo->HT_caps_enable = 1; - for (i = 0; i < (pIE->length); i++) { + for (i = 0; i < umin(pIE->length, + sizeof(pmlmeinfo->HT_caps.u.HT_cap)); i++) { if (i != 2) { /* Commented by Albert 2010/07/12 */ /* Got the endian issue here. */