mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
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: 9dd85e739c ("wifi: rtw89: debug: add mlo_mode dbgfs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/aDbFFkX09K7FrL9h@stanley.mountain
This commit is contained in:
parent
16e3d93c61
commit
53cf488927
|
|
@ -5239,7 +5239,8 @@ int rtw89_core_mlsr_switch(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
|
|||
if (unlikely(!ieee80211_vif_is_mld(vif)))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (unlikely(!(usable_links & BIT(link_id)))) {
|
||||
if (unlikely(link_id >= IEEE80211_MLD_MAX_NUM_LINKS ||
|
||||
!(usable_links & BIT(link_id)))) {
|
||||
rtw89_warn(rtwdev, "%s: link id %u is not usable\n", __func__,
|
||||
link_id);
|
||||
return -ENOLINK;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user