Message ID | a4f6f434d4ec1e5e381d9765a634b6dd08a08070.1629212578.git.ryder.lee@mediatek.com |
---|---|
State | New |
Headers | show |
Series | mt76: add a bound check in mt76_calculate_default_rate() | expand |
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index e282c627e25c..3658328f513b 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1360,6 +1360,10 @@ u16 mt76_calculate_default_rate(struct mt76_phy *phy, int rateidx) if (phy->chandef.chan->band == NL80211_BAND_5GHZ) offset = 4; + /* pick the lowest rate for hidden nodes */ + if (rateidx < 0) + rateidx = 0; + rate = &mt76_rates[offset + rateidx]; return rate->hw_value;
basic_rate could be 0 ie. hidden AP. Always pick the lowest rate for such cases. Fixes: 75fb2e62d444 (mt76: add mt76_default_basic_rate more devices can rely on) Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> --- drivers/net/wireless/mediatek/mt76/mac80211.c | 4 ++++ 1 file changed, 4 insertions(+)