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 5BCCA314D05; Mon, 17 Aug 2026 14:51:27 +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=1786978288; cv=none; b=N2j83SPPzKUaoaE5T+JzfzTMREUx4GoeG2ttIg9JcV4P9rpl9xXsojF7yRVsl3MM0XXkOXG8ObITZtRL/2qkJdOrMdMm0p8WNyMryNDP0VJsgew4kLtthDbN2xsHybQNLAL4w2ntfvZcgKT2+UX9YFnJ80f5AAPAYjbA2fGBvEQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786978288; c=relaxed/simple; bh=GHmb1O2FxAnGgj/s/h1/ijIooIjEXgiu/IR0ECYsDu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PdFvN37xug9zRbOOOFtDqTxvl3pFkf3GK/IYl8IdJHnZOSlomp7qyNyYo2kAITZfHR6IBQOEXSeuyIs4BnQ/rSN5fTFDGIa0SVhiOaodVJ2czA3rWysCi+1seJRKNLN5uo83Ac7p4qw/N8J3pySlL1GzrBjWBa36jc2J2JYW8t0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lm4Kszh5; 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="lm4Kszh5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B576E1F000E9; Mon, 17 Aug 2026 14:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786978287; bh=clrLzxg+aiII/E+d/MhphAWOomFfvIZx6QG4QT/shXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lm4Kszh50u3nRfoJvEmNjPPBT+gcbAAv/GV+2URG7+4Ye+ZS5OVVIoOE1bD4F8NPR t9qFScm2+QuzwrFbxXviAsGzSM0663mx8hpTVgJjTI1PToayDw3WPrUSWRg9Z6rsWG VuqZGl01P1a+FE5jwRju67Boyxu7kCAPsmm73W4Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Muhammad Bilal Subject: [PATCH 6.12 126/181] staging: rtl8723bs: fix OOB read in rtw_get_wpa_ie() Date: Mon, 17 Aug 2026 15:33:40 +0200 Message-ID: <20260817132540.544702984@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132535.394764707@linuxfoundation.org> References: <20260817132535.394764707@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: Muhammad Bilal commit 1c3e23e78862493e8cf1adad02b10ffcb8b9921c upstream. rtw_get_wpa_ie() reads bytes at fixed offsets into a vendor-specific information element without checking that the element is long enough, causing an out-of-bounds read for a short trailing IE. The function locates a vendor-specific IE (EID 221) with rtw_get_ie() and then compares a 4-byte OUI+type at pbuf + 2 and reads a 2-byte version word at pbuf + 6. Those accesses require the IE body to be at least 6 bytes, but rtw_get_ie() only guarantees that the element fits within the buffer; it does not enforce a minimum body length. A vendor-specific IE whose length byte is 0 to 5, placed at the end of the buffer, therefore makes these reads run past the end of the IE and past the end of the buffer itself. The buffer holds information elements taken from received management frames and from the IE blob passed to rtw_cfg80211_set_wpa_ie(), which is kmemdup'd to its exact length, so the read can run off the end of the allocation. The sibling helpers rtw_get_sec_ie(), rtw_get_wapi_ie() and rtw_get_wps_ie() in this file already reject too-short vendor-specific IEs before their OUI memcmp(); rtw_get_wpa_ie() was never brought in line with them, and needs a minimum of 6 rather than 4 bytes because of the version word. Add the missing length check. Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable Signed-off-by: Muhammad Bilal Link: https://patch.msgid.link/20260719030631.88254-1-meatuni001@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c @@ -372,6 +372,9 @@ unsigned char *rtw_get_wpa_ie(unsigned c pbuf = rtw_get_ie(pbuf, WLAN_EID_VENDOR_SPECIFIC, &len, limit_new); if (pbuf) { + if (len < 6) + goto check_next_ie; + /* check if oui matches... */ if (memcmp((pbuf + 2), wpa_oui_type, sizeof(wpa_oui_type))) goto check_next_ie;