Skip to content

Commit 01155de

Browse files
Tristan Madanigregkh
authored andcommitted
wifi: rtw88: fix OOB read from firmware RX descriptor exceeding DMA buffer
[ Upstream commit 6e76e9e ] In rtw_pci_rx_napi(), new_len is computed as the sum of pkt_len (14-bit descriptor field, max 16383) and pkt_offset (drv_info_sz + shift, both firmware-controlled). The result can exceed RTK_PCI_RX_BUF_SIZE (11478), causing an out-of-bounds read from the pre-allocated DMA buffer when skb_put_data copies new_len bytes. The USB transport already validates this (rtw_usb_rx_data_put checks against RTW_USB_MAX_RECVBUF_SZ); the PCIe path does not. Add a check that new_len does not exceed the DMA buffer size. Fixes: e303748 ("rtw88: new Realtek 802.11ac driver") Signed-off-by: Tristan Madani <tristan@talencesecurity.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260421111434.3389674-1-tristmd@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7a1ab5f commit 01155de

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • drivers/net/wireless/realtek/rtw88

drivers/net/wireless/realtek/rtw88/pci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,11 @@ static u32 rtw_pci_rx_napi(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci,
10761076
* discard the frame if none available
10771077
*/
10781078
new_len = pkt_stat.pkt_len + pkt_offset;
1079+
if (unlikely(new_len > RTK_PCI_RX_BUF_SIZE)) {
1080+
rtw_dbg(rtwdev, RTW_DBG_RX,
1081+
"oversized RX packet: %u\n", new_len);
1082+
goto next_rp;
1083+
}
10791084
new = dev_alloc_skb(new_len);
10801085
if (WARN_ONCE(!new, "rx routine starvation\n"))
10811086
goto next_rp;

0 commit comments

Comments
 (0)