brcmfmac: fix WPA/WPA2-PSK 4-way handshake offload and SAE offload failures
authorChung-Hsien Hsu <stanley.hsu@cypress.com>
Tue, 12 May 2020 10:03:08 +0000 (05:03 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 13 May 2020 15:47:38 +0000 (18:47 +0300)
An incorrect value of use_fwsup is set for 4-way handshake offload for
WPA//WPA2-PSK, caused by commit 3b1e0a7bdfee ("brcmfmac: add support for
SAE authentication offload"). It results in missing bit
BRCMF_VIF_STATUS_EAP_SUCCESS set in brcmf_is_linkup() and causes the
failure. This patch correct the value for the case.

Also setting bit BRCMF_VIF_STATUS_EAP_SUCCESS for SAE offload case in
brcmf_is_linkup() to fix SAE offload failure.

Fixes: 3b1e0a7bdfee ("brcmfmac: add support for SAE authentication offload")
Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1589277788-119966-1-git-send-email-chi-hsien.lin@cypress.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

index 579b9306f5338caef09da86a8ce686bee62d43e5..fbec6dd551d65653ee5af69973f47889eb8083d0 100644 (file)
@@ -1820,6 +1820,10 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
                switch (sme->crypto.akm_suites[0]) {
                case WLAN_AKM_SUITE_SAE:
                        val = WPA3_AUTH_SAE_PSK;
+                       if (sme->crypto.sae_pwd) {
+                               brcmf_dbg(INFO, "using SAE offload\n");
+                               profile->use_fwsup = BRCMF_PROFILE_FWSUP_SAE;
+                       }
                        break;
                default:
                        bphy_err(drvr, "invalid cipher group (%d)\n",
@@ -2105,11 +2109,6 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
                goto done;
        }
 
-       if (sme->crypto.sae_pwd) {
-               brcmf_dbg(INFO, "using SAE offload\n");
-               profile->use_fwsup = BRCMF_PROFILE_FWSUP_SAE;
-       }
-
        if (sme->crypto.psk &&
            profile->use_fwsup != BRCMF_PROFILE_FWSUP_SAE) {
                if (WARN_ON(profile->use_fwsup != BRCMF_PROFILE_FWSUP_NONE)) {
@@ -5548,7 +5547,8 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_vif *vif,
        u32 event = e->event_code;
        u32 status = e->status;
 
-       if (vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_PSK &&
+       if ((vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_PSK ||
+            vif->profile.use_fwsup == BRCMF_PROFILE_FWSUP_SAE) &&
            event == BRCMF_E_PSK_SUP &&
            status == BRCMF_E_STATUS_FWSUP_COMPLETED)
                set_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state);