wifi: mt76: mt7925: prevent multiple scan commands
authorMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Mon, 14 Apr 2025 01:39:52 +0000 (09:39 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 22 May 2025 10:57:36 +0000 (12:57 +0200)
Add a check to ensure only one scan command is active at a time
by testing the MT76_HW_SCANNING state.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250414013954.1151774-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

index eed2dd56b5d0f50d76436c29fda6b675254bc2cc..c45eec44d859975d939eabb3be6cacc142a475bd 100644 (file)
@@ -2840,6 +2840,9 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
        struct tlv *tlv;
        int max_len;
 
+       if (test_bit(MT76_HW_SCANNING, &phy->state))
+               return -EBUSY;
+
        max_len = sizeof(*hdr) + sizeof(*req) + sizeof(*ssid) +
                  sizeof(*bssid) * MT7925_RNR_SCAN_MAX_BSSIDS +
                  sizeof(*chan_info) + sizeof(*misc) + sizeof(*ie);