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 AF42744238E; Mon, 17 Aug 2026 15:10:38 +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=1786979440; cv=none; b=TAeInHcAYLucr/OKpyzbyLNm2PVKoC4H92lDoyDNIcF170nUOMHR5g20rhMRa3Fazt1ZasQbOMFsCuMOjBxLL+jl0DBCVTZmOMizZxTrf9QyoBs5M4VQieFPGxtdZX/OBnGtGrWQB088RFMtfBWfUKOdM5PXi+5sZ0PnZkfaBko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786979440; c=relaxed/simple; bh=62fHkttXUw1TRrOjWA5ttNqvh+Xf6aOvaR7B3bkCKog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k6AM6G3CKLOxRANqpjdBWdWfCPzl92aEHbAUpZyn6+RKl2cQc3Q7yMyy80fphDEoZW8o3rRz5n4mycysGWbdLc+M4SPxfYsbPZTMJeO6dwnYY6VZI846KpBaaZuMiYjVaKzO7+xVOattddiXYvE/KqHwNQjX5WWfqeaHX3oQBs8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kbA4UTGx; 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="kbA4UTGx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B0251F00A3A; Mon, 17 Aug 2026 15:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786979438; bh=Bl9pxCwQeKYvn8gSb9m2S23U2xMu3ThZoBwa8rSXS+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kbA4UTGxNNGbG736KHVxf5kh/kRuMW0n8xLJOaGMHoLru/ITgaChrGGuXe7MAe07O 1fvut6Pip9csFPxgY57ZrgK+vEWJxkMto9UbKoaVhKrmI3AfZp1EdH9RS1cnty6InF 5zCtcf7IooxSd19nSeEtj7vcF8jUntu6APRj3VYo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Moksh Panicker Subject: [PATCH 6.1 225/609] staging: rtl8723bs: fix OOB reads in rtw_get_wps_ie() Date: Mon, 17 Aug 2026 15:28:41 +0200 Message-ID: <20260817132551.618133328@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132543.039278408@linuxfoundation.org> References: <20260817132543.039278408@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Moksh Panicker commit 0e95ff792ae0aa6fbad9455943e9e1e4062670e9 upstream. rtw_get_wps_ie() iterates over IE data from network frames without validating that the IE header and payload fit within the remaining buffer before reading them. Specifically: - in_ie[cnt + 1] is read without checking cnt + 1 < in_len - memcmp(&in_ie[cnt + 2], ...) accesses cnt + 2 without bounds check - in_ie[cnt + 1] is used as length without verifying payload fits Add bounds checks at the top of the loop body to break early if fewer than 2 bytes remain for the IE header, or if the declared payload extends past the end of the buffer. Also require at least 4 bytes of payload before comparing the WPS OUI. Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable Signed-off-by: Moksh Panicker Link: https://patch.msgid.link/20260625202911.26782-1-mokshpanicker.7@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c @@ -678,7 +678,14 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_le while (cnt < in_len) { eid = in_ie[cnt]; - if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) { + if (cnt + 2 > in_len) + break; + + if (in_ie[cnt + 1] + 2 > in_len - cnt) + break; + + if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (in_ie[cnt + 1] >= 4) && + (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) { wpsie_ptr = &in_ie[cnt]; if (wps_ie)