mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Bely <vlwwwwww@gmail.com>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Jeff Johnson <jjohnson@kernel.org>
Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, Vladimir Bely <vlwwwwww@gmail.com>
Subject: [PATCH ath-next 2/3] wifi: wcn36xx: track WoWLAN GTK offload validity and skip with MFP
Date: Sun, 29 Nov 2026 02:31:56 +0300	[thread overview]
Message-ID: <20261128233157.966718-3-vlwwwwww@gmail.com> (raw)
In-Reply-To: <20261128233157.966718-1-vlwwwwww@gmail.com>

wcn36xx_set_rekey_data() sets vif_priv->rekey_data.valid = true, but
the flag is never cleared on disconnect or checked in wcn36xx_suspend()
and wcn36xx_resume(). As a result, firmware GTK offload is enabled even
on open networks or with stale KEK/KCK data from a previous association.

Check vif_priv->rekey_data.valid before enabling/disabling GTK offload
during suspend/resume, and clear it on disassociation/BSSID teardown.
Additionally, skip enabling firmware GTK offload when MFP is active
(sta->mfp), as BIP/IGTK is handled in software by mac80211 and older
WCNSS firmware cannot safely offload SAE or IGTK rekeying; waking the
host on group rekey frames lets wpa_supplicant and mac80211 update both
GTK and IGTK consistently.

Signed-off-by: Vladimir Bely <vlwwwwww@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 35 +++++++++++++++++++++----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index ad8a4bd91..f7e0a4aa8 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -835,6 +835,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 					       bss_conf->bssid, false);
 		} else {
 			vif_priv->is_joining = false;
+			vif_priv->rekey_data.valid = false;
 			wcn36xx_smd_delete_bss(wcn, vif);
 			wcn36xx_smd_set_link_st(wcn, bss_conf->bssid, vif->addr,
 						WCN36XX_HAL_LINK_IDLE_STATE);
@@ -906,6 +907,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 				    vif->addr,
 				    vif->cfg.aid);
 			vif_priv->sta_assoc = false;
+			vif_priv->rekey_data.valid = false;
 			wcn36xx_smd_set_link_st(wcn,
 						bss_conf->bssid,
 						vif->addr,
@@ -1102,15 +1104,19 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
 
 	vif = wcn36xx_get_first_assoc_vif(wcn);
 	if (vif) {
+		struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
+
 		ret = wcn36xx_smd_arp_offload(wcn, vif, true);
 		if (ret)
 			goto out;
 		ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true);
 		if (ret)
 			goto out;
-		ret = wcn36xx_smd_gtk_offload(wcn, vif, true);
-		if (ret)
-			goto out;
+		if (vif_priv->rekey_data.valid) {
+			ret = wcn36xx_smd_gtk_offload(wcn, vif, true);
+			if (ret)
+				goto out;
+		}
 		ret = wcn36xx_smd_set_power_params(wcn, true);
 		if (ret)
 			goto out;
@@ -1138,10 +1144,14 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)
 	mutex_lock(&wcn->conf_mutex);
 	vif = wcn36xx_get_first_assoc_vif(wcn);
 	if (vif) {
+		struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
+
 		wcn36xx_smd_host_resume(wcn);
 		wcn36xx_smd_set_power_params(wcn, false);
-		wcn36xx_smd_gtk_offload_get_info(wcn, vif);
-		wcn36xx_smd_gtk_offload(wcn, vif, false);
+		if (vif_priv->rekey_data.valid) {
+			wcn36xx_smd_gtk_offload_get_info(wcn, vif);
+			wcn36xx_smd_gtk_offload(wcn, vif, false);
+		}
 		wcn36xx_smd_ipv6_ns_offload(wcn, vif, false);
 		wcn36xx_smd_arp_offload(wcn, vif, false);
 	}
@@ -1160,15 +1170,30 @@ static void wcn36xx_set_rekey_data(struct ieee80211_hw *hw,
 {
 	struct wcn36xx *wcn = hw->priv;
 	struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
+	struct ieee80211_sta *sta;
 
 	mutex_lock(&wcn->conf_mutex);
 
+	/*
+	 * With MFP active, BIP/IGTK is handled in software by mac80211 and
+	 * firmware GTK offload cannot safely handle SAE/IGTK rekeying.
+	 */
+	rcu_read_lock();
+	sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
+	if (sta && sta->mfp) {
+		rcu_read_unlock();
+		vif_priv->rekey_data.valid = false;
+		goto out;
+	}
+	rcu_read_unlock();
+
 	memcpy(vif_priv->rekey_data.kek, data->kek, NL80211_KEK_LEN);
 	memcpy(vif_priv->rekey_data.kck, data->kck, NL80211_KCK_LEN);
 	vif_priv->rekey_data.replay_ctr =
 		cpu_to_le64(be64_to_cpup((__be64 *)data->replay_ctr));
 	vif_priv->rekey_data.valid = true;
 
+out:
 	mutex_unlock(&wcn->conf_mutex);
 }
 
-- 
2.43.0


  parent reply	other threads:[~2026-11-28 23:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 23:31 [PATCH ath-next 0/3] wifi: wcn36xx: enable MFP (802.11w) support Vladimir Bely
2026-11-28 23:31 ` [PATCH ath-next 1/3] wifi: wcn36xx: set RX decryption flags only on encrypted data frames Vladimir Bely
2026-11-28 23:31 ` Vladimir Bely [this message]
2026-11-28 23:31 ` [PATCH ath-next 3/3] wifi: wcn36xx: enable MFP (802.11w) support Vladimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128233157.966718-3-vlwwwwww@gmail.com \
    --to=vlwwwwww@gmail.com \
    --cc=jjohnson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=wcn36xx@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®