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 EF691426EB3; Thu, 16 Jul 2026 13:44:21 +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=1784209464; cv=none; b=uVmOUd0F7Y9bfbWggmqoeaXg3xCd/V+sz0RBJypmzv5KcMim50tsUonJ7Pf2LwusIrHnLGfSNuWmSOydnN1g/O+p+NeFI8kGV16I1boX/G94q1TyWuaBPco4/1sf9eT0fxEIPMsiqTBxqmY7dC4YXKjyiLk7xnQl+BnsFV0Pi9g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784209464; c=relaxed/simple; bh=mTfYF/gvdEcXXWBWI6kN5kgk3JBK73yzdwRnloTIzRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XQ4ApCiOWgJ3j8X8xeK3P6K+sh0/lo52eblBroA31OT4uxnE7gX+5WwWFULk7CTmI06U+k7tTgZ/0i5u6uI09aDxS4a7msa4uin/syqfDBlK+PuhjnQ+emhSX4pZAtitqvdh3GK0knSx3pjbjJMq54sif8205Uhow/7jnXrI3mE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FzB5AldK; 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="FzB5AldK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 784CA1F00A3D; Thu, 16 Jul 2026 13:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784209461; bh=ylG3AUa4fvgtcJL3dKSrT1u7LqJfogGXePhyM8hK4ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FzB5AldK9zo5X5LEnTHh4A+6QmfLZeTMNIQyJUMmWe0QfrnsrTARpMTZ+J3qmrBWu XU1+kKnzxhLop53U9ynK7ML7/oUrD5mOS4fjn2U/lJRTRwLbxRgQz23ISCuH+TLk1z kp7Dx7JbKU1X9SB4L9ZACoxYjgWW2hHYqqyTzU34= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Alexandru Hossu , Luka Gejak Subject: [PATCH 7.1 167/518] staging: rtl8723bs: fix OOB write in HT_caps_handler() Date: Thu, 16 Jul 2026 15:27:15 +0200 Message-ID: <20260716133051.493574134@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133047.772246337@linuxfoundation.org> References: <20260716133047.772246337@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 7.1-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 @@ -936,7 +936,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. */