wifi: iwlwifi: mvm: check link more carefully
authorJohannes Berg <johannes.berg@intel.com>
Wed, 30 Aug 2023 08:31:01 +0000 (11:31 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 10:36:28 +0000 (12:36 +0200)
Some cases of restart crashing here have been reported,
while we figure out where this is going wrong, check
the link more carefully to avoid the crash.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230830112059.2b81f52ce18e.I8f3b1962013107e2d7491d817c3349359341c6ee@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c

index b4f2b018388cd8fa0dedaa1d9181d1901ce503cd..a4ac178d76b3714fa2812daa1db017be7c8b38ca 100644 (file)
@@ -3883,7 +3883,8 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
 
        /* this would be a mac80211 bug ... but don't crash */
        for_each_sta_active_link(vif, sta, link_sta, link_id) {
-               if (WARN_ON_ONCE(!mvmvif->link[link_id]->phy_ctxt)) {
+               if (WARN_ON_ONCE(!mvmvif->link[link_id] ||
+                                !mvmvif->link[link_id]->phy_ctxt)) {
                        mutex_unlock(&mvm->mutex);
                        return test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
                                        &mvm->status) ? 0 : -EINVAL;