Skip to content

Commit ad445de

Browse files
Tristan Madanigregkh
authored andcommitted
wifi: rtw89: add bounds check on firmware mac_id in link lookup
[ Upstream commit 6d88244 ] The mac_id field in RX descriptors is 8 bits wide (0-255), but assoc_link_on_macid[] has only RTW89_MAX_MAC_ID_NUM (128) entries. While the driver currently assigns mac_id values below 128, the descriptor value comes from firmware and is not validated before use as an array index. Add a defensive bounds check in rtw89_assoc_link_rcu_dereference() to guard against out-of-range firmware values. Fixes: 144c6cd ("wifi: rtw89: 8922a: configure AP_LINK_PS if FW supports") Signed-off-by: Tristan Madani <tristan@talencesecurity.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260421111442.3395411-1-tristmd@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 01155de commit ad445de

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • drivers/net/wireless/realtek/rtw89

drivers/net/wireless/realtek/rtw89/core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6254,6 +6254,9 @@ static inline void rtw89_assoc_link_clr(struct rtw89_sta_link *rtwsta_link)
62546254
static inline struct rtw89_sta_link *
62556255
rtw89_assoc_link_rcu_dereference(struct rtw89_dev *rtwdev, u8 macid)
62566256
{
6257+
if (unlikely(macid >= RTW89_MAX_MAC_ID_NUM))
6258+
return NULL;
6259+
62576260
return rcu_dereference(rtwdev->assoc_link_on_macid[macid]);
62586261
}
62596262

0 commit comments

Comments
 (0)