Skip to content

Commit ef61d62

Browse files
ahossugregkh
authored andcommitted
staging: rtl8723bs: fix OOB reads in IE loops in issue_assocreq() and join_cmd_hdl()
Two IE parsing loops are missing the header bounds checks before they dereference pIE->length: - issue_assocreq() walks pmlmeinfo->network.ies to build the association request. If the stored IE data ends with only an element_id byte and no length byte, pIE->length is read one byte past the end of the buffer. - join_cmd_hdl() walks pnetwork->ies during station join and has the same problem under the same conditions. Both buffers are filled from AP beacon and probe-response frames, so a malicious AP that sends a truncated final IE can trigger the issue. Apply the two-guard pattern established in update_beacon_info(): 1. Break if fewer than sizeof(*pIE) bytes remain. 2. Break if the IE's declared data extends past the buffer end. Fixes: 554c0a3 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable <stable@kernel.org> Reviewed-by: Luka Gejak <luka.gejak@linux.dev> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com> Link: https://patch.msgid.link/20260522004531.1038924-3-hossu.alexandru@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ed51de4 commit ef61d62

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/staging/rtl8723bs/core/rtw_mlme_ext.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,7 +2861,11 @@ void issue_assocreq(struct adapter *padapter)
28612861

28622862
/* vendor specific IE, such as WPA, WMM, WPS */
28632863
for (i = sizeof(struct ndis_802_11_fix_ie); i < pmlmeinfo->network.ie_length;) {
2864+
if (i + sizeof(*pIE) > pmlmeinfo->network.ie_length)
2865+
break;
28642866
pIE = (struct ndis_80211_var_ie *)(pmlmeinfo->network.ies + i);
2867+
if (i + sizeof(*pIE) + pIE->length > pmlmeinfo->network.ie_length)
2868+
break;
28652869

28662870
switch (pIE->element_id) {
28672871
case WLAN_EID_VENDOR_SPECIFIC:
@@ -5189,7 +5193,11 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf)
51895193

51905194
/* sizeof(struct ndis_802_11_fix_ie) */
51915195
for (i = _FIXED_IE_LENGTH_; i < pnetwork->ie_length;) {
5196+
if (i + sizeof(*pIE) > pnetwork->ie_length)
5197+
break;
51925198
pIE = (struct ndis_80211_var_ie *)(pnetwork->ies + i);
5199+
if (i + sizeof(*pIE) + pIE->length > pnetwork->ie_length)
5200+
break;
51935201

51945202
switch (pIE->element_id) {
51955203
case WLAN_EID_VENDOR_SPECIFIC:/* Get WMM IE. */

0 commit comments

Comments
 (0)