mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 11:03:07 -04:00
wifi: rtw89: add bounds check on firmware mac_id in link lookup
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: 144c6cd24b ("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
This commit is contained in:
committed by
Ping-Ke Shih
parent
6e76e9ed27
commit
6d88244bb1
@@ -6527,6 +6527,9 @@ static inline void rtw89_assoc_link_clr(struct rtw89_sta_link *rtwsta_link)
|
||||
static inline struct rtw89_sta_link *
|
||||
rtw89_assoc_link_rcu_dereference(struct rtw89_dev *rtwdev, u8 macid)
|
||||
{
|
||||
if (unlikely(macid >= RTW89_MAX_MAC_ID_NUM))
|
||||
return NULL;
|
||||
|
||||
return rcu_dereference(rtwdev->assoc_link_on_macid[macid]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user