CVE-2026-139057: wifi: rtw88: fix out-of-bounds CAM write when key table is full
In the Linux kernel, the following vulnerability has been resolved:
wifi: rtw88: fix out-of-bounds CAM write when key table is full
In rtwopssetkey(), when the CAM table is full, rtwsecgetfreecam() returns RTWMAXSECCAMNUM (32) because findnextzerobit()/findfirstzerobit() return the bitmap size when no free slot exists. The bounds check compares the returned index with ">" against totalcamnum (32), so the invalid index 32 passes the check.
rtwsecwritecam() then indexes camtable[32], an array declared with RTWMAXSECCAMNUM (32) entries, causing an out-of-bounds write that corrupts the cammap allocation bitmap. The write also sets bit 32 of cammap, which overruns the bitmap as well.
Fix the off-by-one by rejecting indices >= totalcamnum.
Tested on: RTL8821CE (PCIe) on kernel 7.2.0-rc6-rtw88test-00059-g0d8395707651. The patched module loaded and associated to a WPA2 network; ping traffic passed with 0% packet loss. Reassociation and disconnect/reconnect cycles completed without errors, and the CAM table (debugfs dumpcam) showed valid key entries. The CAM-full boundary (28+ pairwise keys) requires an access point with 28+ clients and is not reachable in a single-client setup, so that path was verified by code inspection.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In rtw_ops_set_key(), reject CAM indices greater than or equal to total_cam_num to prevent out-of-bounds writes when the CAM table is full.
Event History
Frequently Asked Questions
What environment is needed to reach the stated CAM-table boundary?
The described boundary requires 28 or more pairwise keys and an access point with 28 or more clients. The affected path is in the rtw88 Wi-Fi driver.
What hardware and network scenario was used to validate the fix?
The fix was tested on an RTL8821CE PCIe adapter with a WPA2 network. Association, ping traffic, reassociation, and disconnect/reconnect cycles completed without errors in that test.
Are specific fixed kernel release versions provided?
No fixed kernel release versions are listed. The provided references identify three stable-kernel commits containing the fix.