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 707D63FE65F; Thu, 16 Jul 2026 13:43:02 +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=1784209383; cv=none; b=sA3puxLwRCVx1oorQKC92mkLHm2Ng3NfLMsr3k9xrOMSEiUyVFwV5gmN6WiGTxn/JP6XYXxwoLnX7cP3PaVlDA/syzOmthGWNtRduCOJ8TzSPfVMj0mn1A0xbd7k7A1dGZbydOB2S04wVZRRnIXHGdJ11xrxobHeqsegZf5A/WQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784209383; c=relaxed/simple; bh=ad8MJ6xUiAlpmGonvyhyTAWTuNHrsqEgXVveE2hbSiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ENCWsoJh/jg3j6q/IegUi/7jdgiikGZQuF2RDek4BaENdzaEdyM2onhP/Vs5RLtDyKoNhXQ28TcRgzbGFku/mTCDWphTWH/3xuWtynrtisC+1/0wkSxAtBmgo2KOc0j4AKUjcMW3tp2FQJy+AAsuafl9aKlSZWqfvtMmhHlbpZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gKBKYxjO; 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="gKBKYxjO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0C981F000E9; Thu, 16 Jul 2026 13:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784209382; bh=u4nKw1w/BGE1XdPxVpkuUAhlptjyL6RjakmSQsRML+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gKBKYxjOQmEiRiX+5YGZZieA9AzMicW1t5FWDMnXZjV5q5gjmGuypwmfjYETZga0O LbkyuMktjY7kbE9zcyZ4qGa/7RuGuXWpzUnjogtOinAbIncjJdU73t6qvOGMUfgDGg o2vVGY823PV9wYA4JKmi1m75vDEQsUCeC1MaGSyA= 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 162/518] staging: rtl8723bs: fix OOB read in OnAssocRsp() IE loop Date: Thu, 16 Jul 2026 15:27:10 +0200 Message-ID: <20260716133051.387107697@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 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 @@ -1406,7 +1406,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: