Patch "wifi: ath12k: fix key cache handling" has been added to the 6.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    wifi: ath12k: fix key cache handling

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     wifi-ath12k-fix-key-cache-handling.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 08c2599909921e430bb2a52a9953434a42a7887c
Author: Aditya Kumar Singh <quic_adisi@xxxxxxxxxxx>
Date:   Sun Jan 12 11:23:00 2025 +0530

    wifi: ath12k: fix key cache handling
    
    [ Upstream commit 336097d74c284a7c928b723ce8690f28912da03d ]
    
    Currently, an interface is created in the driver during channel assignment.
    If mac80211 attempts to set a key for an interface before this assignment,
    the driver caches the key. Once the interface is created, the driver
    installs the cached key to the hardware. This sequence is exemplified in
    mesh mode operation where the group key is set before channel assignment.
    
    However, in ath12k_mac_update_key_cache(), after caching the key, due to
    incorrect logic, it is deleted from the cache during the subsequent loop
    iteration. As a result, after the interface is created, the driver does not
    find any cached key, and the key is not installed to the hardware which is
    wrong. This leads to issue in mesh, where broadcast traffic is not
    encrypted over the air.
    
    Fix this issue by adjusting the logic of ath12k_mac_update_key_cache()
    properly.
    
    Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
    Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3-03253.1-QCAHKSWPL_SILICONZ-29 # Nicolas Escande <nico.escande@xxxxxxxxx>
    Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1  # Nicolas Escande <nico.escande@xxxxxxxxx>
    
    Fixes: 25e18b9d6b4b ("wifi: ath12k: modify ath12k_mac_op_set_key() for MLO")
    Signed-off-by: Aditya Kumar Singh <quic_adisi@xxxxxxxxxxx>
    Acked-by: Kalle Valo <kvalo@xxxxxxxxxx>
    Tested-by: Nicolas Escande <nico.escande@xxxxxxxxx>
    Link: https://patch.msgid.link/20250112-fix_key_cache_handling-v2-1-70e142c6153e@xxxxxxxxxxx
    Signed-off-by: Jeff Johnson <jeff.johnson@xxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index fd2919f84d6f7..ef2736fb5f53f 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -4316,7 +4316,23 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache,
 				       struct ieee80211_sta *sta,
 				       struct ieee80211_key_conf *key)
 {
-	struct ath12k_key_conf *key_conf = NULL, *tmp;
+	struct ath12k_key_conf *key_conf, *tmp;
+
+	list_for_each_entry_safe(key_conf, tmp, &cache->key_conf.list, list) {
+		if (key_conf->key != key)
+			continue;
+
+		/* If SET key entry is already present in cache, nothing to do,
+		 * just return
+		 */
+		if (cmd == SET_KEY)
+			return 0;
+
+		/* DEL key for an old SET key which driver hasn't flushed yet.
+		 */
+		list_del(&key_conf->list);
+		kfree(key_conf);
+	}
 
 	if (cmd == SET_KEY) {
 		key_conf = kzalloc(sizeof(*key_conf), GFP_KERNEL);
@@ -4330,17 +4346,7 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache,
 		list_add_tail(&key_conf->list,
 			      &cache->key_conf.list);
 	}
-	if (list_empty(&cache->key_conf.list))
-		return 0;
-	list_for_each_entry_safe(key_conf, tmp, &cache->key_conf.list, list) {
-		if (key_conf->key == key) {
-			/* DEL key for an old SET key which driver hasn't flushed yet.
-			 */
-			list_del(&key_conf->list);
-			kfree(key_conf);
-			break;
-		}
-	}
+
 	return 0;
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux