mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
wifi: mt76: mt7925: fix off by one in mt7925_mcu_hw_scan()
The ssid->ssids[] and sreq->ssids[] arrays have MT7925_RNR_SCAN_MAX_BSSIDS
elements so this >= needs to be > to prevent an out of bounds access.
Fixes: 8284815ca1
("wifi: mt76: mt7925: add RNR scan support for 6GHz")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aDVT2tPhG_8T0Qla@stanley.mountain
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
ac9c50c79e
commit
b3a431fe2e
1 changed files with 2 additions and 2 deletions
|
@ -2866,7 +2866,7 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
|
||||||
for (i = 0; i < sreq->n_ssids; i++) {
|
for (i = 0; i < sreq->n_ssids; i++) {
|
||||||
if (!sreq->ssids[i].ssid_len)
|
if (!sreq->ssids[i].ssid_len)
|
||||||
continue;
|
continue;
|
||||||
if (i > MT7925_RNR_SCAN_MAX_BSSIDS)
|
if (i >= MT7925_RNR_SCAN_MAX_BSSIDS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ssid->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
|
ssid->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
|
||||||
|
@ -2883,7 +2883,7 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
|
||||||
mt76_connac_mcu_build_rnr_scan_param(mdev, sreq);
|
mt76_connac_mcu_build_rnr_scan_param(mdev, sreq);
|
||||||
|
|
||||||
for (j = 0; j < mdev->rnr.bssid_num; j++) {
|
for (j = 0; j < mdev->rnr.bssid_num; j++) {
|
||||||
if (j > MT7925_RNR_SCAN_MAX_BSSIDS)
|
if (j >= MT7925_RNR_SCAN_MAX_BSSIDS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID,
|
tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID,
|
||||||
|
|
Loading…
Add table
Reference in a new issue