1: 20387a8c7947 ! 1: 42b0dba7a30f wifi: ath11k: forget a key the firmware failed to remove @@ Commit message freed keys to ath11k_install_key() from ath11k_clear_peer_keys().  Clear the host reference to a disabled key also when the firmware - command fails. + command fails, and still return the first error to mac80211.  Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.12-01460  @@ Commit message Signed-off-by: Julius Bairaktaris   ## drivers/net/wireless/ath/ath11k/mac.c ## +@@ drivers/net/wireless/ath/ath11k/mac.c: static int ath11k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + bool is_ap_with_no_sta; + const u8 *peer_addr; + int ret = 0; ++ int pn_ret; + u32 flags = 0; +  + /* BIP needs to be done in software */  @@ drivers/net/wireless/ath/ath11k/mac.c: static int ath11k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, is_ap_with_no_sta = (vif->type == NL80211_IFTYPE_AP && !arvif->num_stations); if (flags == WMI_KEY_PAIRWISE || cmd == SET_KEY || is_ap_with_no_sta) { -+ /* mac80211 frees a disabled key whatever this returns, so ++ /* ++ * mac80211 frees a disabled key whatever this returns, so  + * forget it below even if the firmware did not remove it.  + */ ret = ath11k_install_key(arvif, key, cmd, peer_addr, flags); @@ drivers/net/wireless/ath/ath11k/mac.c: static int ath11k_mac_op_set_key(struct i  + goto exit; }  - ret = ath11k_dp_peer_rx_pn_replay_config(arvif, peer_addr, cmd, key); - if (ret) { +- ret = ath11k_dp_peer_rx_pn_replay_config(arvif, peer_addr, cmd, key); +- if (ret) { ++ pn_ret = ath11k_dp_peer_rx_pn_replay_config(arvif, peer_addr, cmd, key); ++ if (pn_ret) { ath11k_warn(ab, "failed to offload PN replay detection %d\n", - ret); +- ret);  - goto exit; ++ pn_ret); ++ if (!ret) ++ ret = pn_ret;  + if (cmd == SET_KEY)  + goto exit; } 2: eaec413d0675 = 2: 6b71d5930346 wifi: ath11k: do not fail down transitions of the station state