* [PATCH 6.1.y] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction
@ 2026-11-26 14:04 Dickson Wu via B4 Relay
2026-11-27 17:01 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Dickson Wu via B4 Relay @ 2026-11-26 14:04 UTC (permalink / raw)
To: stable; +Cc: Salman Alghamdi, Luka Gejak, linux-staging
From: Salman Alghamdi <me@cipherat.com>
commit 88e994c57a79f62d5338231d8d37ee8dd98baffe upstream.
Add guards to ensure ie_length is large enough before subtracting
fixed IE offsets to prevent unsigned integer underflow.
Fixes: 2038fe84b8bd ("staging: rtl8723bs: fix spacing around operators")
Fixes: d3fcee1b78a5 ("staging: rtl8723bs: fix camel case in struct wlan_bssid_ex")
Closes: https://lore.kernel.org/linux-staging/DI2H39EAAFBZ.3KI5NWN02AQ2S@linux.dev/
Cc: stable <stable@kernel.org>
Signed-off-by: Salman Alghamdi <me@cipherat.com>
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Link: https://patch.msgid.link/20260513203455.31792-1-me@cipherat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ adapted to 6.1.y: preserve branch WPS helper-call spacing ]
Signed-off-by: Dickson Wu <dickson.wu@certik.com>
---
6.6.y and newer already have this fix. The added lines are the
same as upstream. The WPS lookup next to them keeps this branch's
older spacing, which is why it doesn't cherry-pick cleanly.
Tested on v6.1.193:
- x86_64 allmodconfig W=1 build of
drivers/staging/rtl8723bs/core/rtw_mlme.o, base vs patched, no new
warnings
- booted the patched kernel with the driver built as a module under
QEMU/KVM. I don't have rtl8723bs hardware, so the scan path wasn't
run.
The backport and the test runs were prepared with AI coding tools
(OpenAI Codex agents, with review by Claude). I went over the result
before signing off.
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index ac3a08e6727f..8a83d1fedeac 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -658,6 +658,8 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
privacy = pnetwork->network.privacy;
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
+ if (pnetwork->network.ie_length < _FIXED_IE_LENGTH_)
+ return false;
if (rtw_get_wps_ie(pnetwork->network.ies+_FIXED_IE_LENGTH_, pnetwork->network.ie_length-_FIXED_IE_LENGTH_, NULL, &wps_ielen))
return true;
else
@@ -672,11 +674,15 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
bselected = false;
if (psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPA2PSK) {
- p = rtw_get_ie(pnetwork->network.ies + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.ie_length - _BEACON_IE_OFFSET_));
- if (p && ie_len > 0)
- bselected = true;
- else
+ if (pnetwork->network.ie_length < _BEACON_IE_OFFSET_) {
bselected = false;
+ } else {
+ p = rtw_get_ie(pnetwork->network.ies + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.ie_length - _BEACON_IE_OFFSET_));
+ if (p && ie_len > 0)
+ bselected = true;
+ else
+ bselected = false;
+ }
}
}
---
base-commit: 1ca1436ccc68275d0b43b6a730b3940fcc46b7c2
change-id: 20261126-so3-rtl-61-a710ef272f1f
Best regards,
--
Dickson Wu <dickson.wu@certik.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 6.1.y] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction
2026-11-26 14:04 [PATCH 6.1.y] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction Dickson Wu via B4 Relay
@ 2026-11-27 17:01 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-27 17:01 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Salman Alghamdi, Luka Gejak, linux-staging,
Dickson Wu via B4 Relay, Dickson Wu
> Add guards to ensure ie_length is large enough before subtracting
> fixed IE offsets to prevent unsigned integer underflow.
Queued for 6.1, 5.15 and 5.10, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 14:04 [PATCH 6.1.y] staging: rtl8723bs: rtw_mlme: add bounds checks before ie_length subtraction Dickson Wu via B4 Relay
2026-11-27 17:01 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox