Skip to content

Commit 53cf488

Browse files
Dan CarpenterPing-Ke Shih
authored andcommitted
wifi: rtw89: mcc: prevent shift wrapping in rtw89_core_mlsr_switch()
The "link_id" value comes from the user via debugfs. If it's larger than BITS_PER_LONG then that would result in shift wrapping and potentially an out of bounds access later. In fact, we can limit it to IEEE80211_MLD_MAX_NUM_LINKS (15). Fortunately, only root can write to debugfs files so the security impact is minimal. Fixes: 9dd85e7 ("wifi: rtw89: debug: add mlo_mode dbgfs") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Zong-Zhe Yang <[email protected]> Signed-off-by: Ping-Ke Shih <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 16e3d93 commit 53cf488

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/wireless/realtek/rtw89

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5239,7 +5239,8 @@ int rtw89_core_mlsr_switch(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
52395239
if (unlikely(!ieee80211_vif_is_mld(vif)))
52405240
return -EOPNOTSUPP;
52415241

5242-
if (unlikely(!(usable_links & BIT(link_id)))) {
5242+
if (unlikely(link_id >= IEEE80211_MLD_MAX_NUM_LINKS ||
5243+
!(usable_links & BIT(link_id)))) {
52435244
rtw89_warn(rtwdev, "%s: link id %u is not usable\n", __func__,
52445245
link_id);
52455246
return -ENOLINK;

0 commit comments

Comments
 (0)