Skip to content

Commit d1344ad

Browse files
Ping-Ke Shih1Naim
authored andcommitted
wifi: rtw88: validate RX rate to prevent out-of-bound
The reported RX rate might be unexpected, causing kernel warns: Rate marked as a VHT rate but data is invalid: MCS: 0, NSS: 0 WARNING: net/mac80211/rx.c:5491 at ieee80211_rx_list+0x183/0x1020 [mac80211] As the RX rate can be index of an array under certain conditions, validate it to prevent accessing array out-of-bound potentially. Tested on HP Notebook P3S95EA#ACB (kernel 6.19.9-1-cachyos): - No WARNING: net/mac80211/rx.c:5491 observed after patch. - System remains fully stable through idle, load, Bluetooth A2DP usage, and multiple suspend/resume cycles. - Zero H2C or LPS errors in dmesg. Reported-by: Oleksandr Havrylov <goainwo@gmail.com> Closes: https://lore.kernel.org/linux-wireless/CALdGYqSMUPnPfW-_q1RgYr0_SjoXUejAaJJr-o+jpwCk1S7ndQ@mail.gmail.com/ Tested-by: Oleksandr Havrylov <goainwo@gmail.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
1 parent 41cc257 commit d1344ad

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • drivers/net/wireless/realtek/rtw88

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,14 @@ void rtw_rx_query_rx_desc(struct rtw_dev *rtwdev, void *rx_desc8,
295295

296296
pkt_stat->tsf_low = le32_get_bits(rx_desc->w5, RTW_RX_DESC_W5_TSFL);
297297

298+
if (unlikely(pkt_stat->rate >= DESC_RATE_MAX)) {
299+
rtw_dbg(rtwdev, RTW_DBG_UNEXP,
300+
"unexpected RX rate=0x%x\n", pkt_stat->rate);
301+
302+
pkt_stat->rate = DESC_RATE1M;
303+
pkt_stat->bw = RTW_CHANNEL_WIDTH_20;
304+
}
305+
298306
/* drv_info_sz is in unit of 8-bytes */
299307
pkt_stat->drv_info_sz *= 8;
300308

0 commit comments

Comments
 (0)