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 E035441F34F; Thu, 16 Jul 2026 14:24:57 +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=1784211899; cv=none; b=UpPhd+uYo/KbLeeR4hO225GBBP4Put/qerBPQAtcjjMhvXps/u0i12Xk4IWuJZv5ay+l1X4IRRqW5uWehAy2+aaAnpqTMLa78sgsLLEuTCSTYFpjlGmKxD2t6QsgFhfvoaRgNU7d2//8CbSZwdXO2mn4NMxviPr5ozIB8xs08vc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211899; c=relaxed/simple; bh=RVF32a+bJl1PSrA/xKVCXjhjsWnPEOIi2QU5thxopGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YOsoaMN1BHvVmxFkK70pp0ysawGGGa1SJJXfObwAXstas6qv8YNGua6a3fqsnbM4RUYYmzTOX/5eigI5Yj2VhQRDjgl8kIzlPHqLBXhoRIca6F013dQySUF+xIQypNnWOYCk2m3bvi15Qx3rLvUjZvN+jwezkWPkaCboCMNOqs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dXxXopqX; 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="dXxXopqX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FE441F00A3D; Thu, 16 Jul 2026 14:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784211897; bh=ju98/n+Jg69Hxr8nE9x+++qlVhkz6E2VeVMDWytLZ8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dXxXopqXsmOB19aN6Ldh3hwB20E2pJBz8hweIR3Cp9Jj/uhy/r2GCC6V8Tv6yryoj GRb1BSo2SysUpCOpx37YPwAUzs9GQT0xbLyQrnlRZqFpe0qeQOpZxJ42mEsBcnSuiY oa5+FyVEvJhKTFXfsixxwuV8eMMJ0AyQ+dRuNGHY= 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 122/349] staging: rtl8723bs: fix OOB read in OnAssocRsp() IE loop Date: Thu, 16 Jul 2026 15:30:56 +0200 Message-ID: <20260716133036.089936000@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 f9654207e92283e0acac5d64fe5f8835383b5a23 upstream. The IE parsing loop in OnAssocRsp() advances by (pIE->length + 2) each iteration but only guards on i < pkt_len. When a malicious AP sends an AssocResponse whose last IE has only one byte remaining in the frame (the element_id byte lands at pkt_len-1), the loop reads pIE->length from pframe[pkt_len], which is one byte past the allocated receive buffer. Additionally, even when the header bytes are in bounds, pIE->length itself can extend the data window beyond pkt_len, silently passing a truncated IE to the handler functions. Add two guards at the top of the loop body: 1. Break if fewer than sizeof(*pIE) bytes remain (can't read header). 2. Break if the IE's declared data extends past pkt_len. 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-6-hossu.alexandru@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -1424,7 +1424,11 @@ unsigned int OnAssocRsp(struct adapter * /* to handle HT, WMM, rate adaptive, update MAC reg */ /* for not to handle the synchronous IO in the tasklet */ for (i = (6 + WLAN_HDR_A3_LEN); i < pkt_len;) { + if (i + sizeof(*pIE) > pkt_len) + break; pIE = (struct ndis_80211_var_ie *)(pframe + i); + if (i + sizeof(*pIE) + pIE->length > pkt_len) + break; switch (pIE->element_id) { case WLAN_EID_VENDOR_SPECIFIC: