linux/drivers/staging
Alexandru Hossu 1463ca3ec6 staging: rtl8723bs: fix OOB reads in rtw_get_sec_ie(), rtw_get_wapi_ie(), and rtw_get_wps_attr()
Three IE/attribute parsing functions have missing bounds checks.

rtw_get_sec_ie() and rtw_get_wapi_ie() iterate over a raw IE buffer
without verifying that the header bytes (tag + length) are within the
remaining buffer before reading them.  Additionally, rtw_get_sec_ie()
compares the 4-byte WPA OUI at cnt+2 without checking that at least
6 bytes remain, and rtw_get_wapi_ie() compares a 4-byte WAPI OUI at
cnt+6 without checking that at least 10 bytes remain.

rtw_get_wps_attr() reads wps_ie[0] and wps_ie+2 unconditionally at
entry, before verifying that wps_ielen is large enough to contain
the 6-byte WPS IE header (element_id + length + 4-byte OUI).  Inside
the attribute loop, get_unaligned_be16() is called on attr_ptr and
attr_ptr+2 without checking that 4 bytes remain in the buffer.

Add a cnt+2 bounds check before each loop body in rtw_get_sec_ie()
and rtw_get_wapi_ie(), guard each multi-byte comparison with a minimum
IE length requirement, add a wps_ielen < 6 early return in
rtw_get_wps_attr(), and add a 4-byte bounds check in its inner loop.

Fixes: 554c0a3abf ("staging: Add rtl8723bs sdio wifi driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
Link: https://patch.msgid.link/20260522004531.1038924-8-hossu.alexandru@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-07 13:43:27 +02:00
..
axis-fifo staging: axis-fifo: refactor device tree parsing 2026-02-23 15:45:31 +01:00
fbtft staging: fbtft: remove unused function fbtft_write_gpio16_wr_latched 2026-05-04 16:49:10 +02:00
greybus Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
iio Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
media [GIT PULL for v7.2] media updates 2026-06-18 17:21:54 -07:00
most staging: most: video: avoid double free on video register failure 2026-05-21 12:42:38 +02:00
nvec staging: nvec: fix unconditional pm_power_off teardown 2026-05-04 16:17:10 +02:00
octeon staging: octeon: replace pr_warn with dev_warn in fill and rx paths 2026-05-21 11:20:45 +02:00
rtl8723bs staging: rtl8723bs: fix OOB reads in rtw_get_sec_ie(), rtw_get_wapi_ie(), and rtw_get_wps_attr() 2026-07-07 13:43:27 +02:00
sm750fb staging: sm750: rename CamelCase variable Bpp to bpp 2026-05-21 12:41:39 +02:00
vc04_services Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vme_user staging: vme_user: fix location monitor leak in tsi148 bridge 2026-07-07 13:41:56 +02:00
Kconfig
Makefile