[PATCH v4 0/2] wifi: rtw89: bounds-check firmware element parsing

From
Falconet3 <hidden>
Date
2026-11-23 18:22:25
Two bounds-check fixes in the rtw89 firmware element parser, both found
while auditing drivers/net/wireless/realtek/rtw89/fw.c.

1/2: __rtw89_fw_recognize_elements() checks only the element body
against firmware->size and ignores the 32-byte element header, so an
element whose body ends one byte before the end of the buffer is read up
to 31 bytes past it; for firmware larger than 2 MB those bytes are also
copied into a persistent devm_ buffer. The same loop's start offset is
unvalidated, and on 32-bit "offset + sizeof(*hdr)" wraps.

2/2: rtw89_board_elm_seek() validates the entry with "ofst + size" in
u32, which wraps, so a crafted board element file can set pseudo_fw->data
far outside the buffer.

Both need a crafted firmware or board element file loaded by the driver,
so these are hardening fixes, not remote attack vectors. No reproducer;
compile- and sparse-tested on x86_64.

---
v4: resend as a new thread at the maintainer's request; no code change
    since v3.
v3: resend of the series with the correct subjects and version label; no
    code change since v2.
v2: 1/2: validate the walk start offset before dereferencing hdr (fixes
    the 32-bit wrap) and use size_t remainder arithmetic; 2/2: new,
    split out as an independent caller.

 drivers/net/wireless/realtek/rtw89/fw.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help