wifi: iwlwifi: mvm: fix recovery flow in CSA
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 13 Sep 2023 11:56:46 +0000 (14:56 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 13 Sep 2023 14:11:40 +0000 (16:11 +0200)
If the firmware crashes in the de-activation / re-activation
of the link during CSA, we will not have a valid phy_ctxt
pointer in mvmvif. This is a legit case, but when mac80211
removes the station to cleanup our state during the
re-configuration, we need to make sure we clear ap_sta
otherwise we won't re-add the station after the firmware has
been restarted. Later on, we'd activate the link, try to send
a TLC command crash again on ASSERT 3508.

Fix this by properly cleaning up our state.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230913145231.2651e6f6a55a.I4cd50e88ee5c23c1c8dd5b157a800e4b4c96f236@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c

index 2fb5fb41f508847ce46a88b80350ff6eb2f8fe62..98172da346fb1f7b1f4cd619455b300d12f363df 100644 (file)
@@ -1033,6 +1033,7 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
        spin_unlock_bh(&mvm->time_event_lock);
 
        memset(&mvmvif->bf_data, 0, sizeof(mvmvif->bf_data));
+       mvmvif->ap_sta = NULL;
 
        for_each_mvm_vif_valid_link(mvmvif, link_id) {
                mvmvif->link[link_id]->ap_sta_id = IWL_MVM_INVALID_STA;
@@ -3871,7 +3872,11 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
 
        mutex_lock(&mvm->mutex);
 
-       /* this would be a mac80211 bug ... but don't crash */
+       /* this would be a mac80211 bug ... but don't crash, unless we had a
+        * firmware crash while we were activating a link, in which case it is
+        * legit to have phy_ctxt = NULL. Don't bother not to WARN if we are in
+        * recovery flow since we spit tons of error messages anyway.
+        */
        for_each_sta_active_link(vif, sta, link_sta, link_id) {
                if (WARN_ON_ONCE(!mvmvif->link[link_id] ||
                                 !mvmvif->link[link_id]->phy_ctxt)) {