]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wcn36xx: Ensure finish scan is not requested before start scan
authorJoseph Gates <jgates@squareup.com>
Wed, 18 Aug 2021 11:31:43 +0000 (13:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:41:46 +0000 (13:41 +0200)
commit d195d7aac09bddabc2c8326fb02fcec2b0a2de02 upstream.

If the operating channel is the first in the scan list, it was seen that
a finish scan request would be sent before a start scan request was
sent, causing the firmware to fail all future scans. Track the current
channel being scanned to avoid requesting the scan finish before it
starts.

Cc: <stable@vger.kernel.org>
Fixes: 5973a2947430 ("wcn36xx: Fix software-driven scan")
Signed-off-by: Joseph Gates <jgates@squareup.com>
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1629286303-13179-1-git-send-email-loic.poulain@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/ath/wcn36xx/main.c
drivers/net/wireless/ath/wcn36xx/wcn36xx.h

index dabed4e3ca457afa9aa86e97937430d09a195254..e8c772a6717643a01c57228abac32aebf3378644 100644 (file)
@@ -405,13 +405,14 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
                wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
                            ch);
 
-               if (wcn->sw_scan_opchannel == ch) {
+               if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) {
                        /* If channel is the initial operating channel, we may
                         * want to receive/transmit regular data packets, then
                         * simply stop the scan session and exit PS mode.
                         */
                        wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN,
                                                wcn->sw_scan_vif);
+                       wcn->sw_scan_channel = 0;
                } else if (wcn->sw_scan) {
                        /* A scan is ongoing, do not change the operating
                         * channel, but start a scan session on the channel.
@@ -419,6 +420,7 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
                        wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
                                              wcn->sw_scan_vif);
                        wcn36xx_smd_start_scan(wcn, ch);
+                       wcn->sw_scan_channel = ch;
                } else {
                        wcn36xx_change_opchannel(wcn, ch);
                }
@@ -699,6 +701,7 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
 
        wcn->sw_scan = true;
        wcn->sw_scan_vif = vif;
+       wcn->sw_scan_channel = 0;
        if (vif_priv->sta_assoc)
                wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn);
        else
index 71fa9992b118cbd7ad82d4918b0a78c0401e4e9f..d0fcce86903aeb2a373557f7390330be9643d3cc 100644 (file)
@@ -232,6 +232,7 @@ struct wcn36xx {
        struct cfg80211_scan_request *scan_req;
        bool                    sw_scan;
        u8                      sw_scan_opchannel;
+       u8                      sw_scan_channel;
        struct ieee80211_vif    *sw_scan_vif;
        struct mutex            scan_lock;
        bool                    scan_aborted;