]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: mvm: guard against invalid STA ID on removal
authorBenjamin Berg <benjamin.berg@intel.com>
Wed, 20 Mar 2024 21:26:23 +0000 (23:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:14:38 +0000 (12:14 +0200)
[ Upstream commit 17f64517bf5c26af56b6c3566273aad6646c3c4f ]

Guard against invalid station IDs in iwl_mvm_mld_rm_sta_id as that would
result in out-of-bounds array accesses. This prevents issues should the
driver get into a bad state during error handling.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240320232419.d523167bda9c.I1cffd86363805bf86a95d8bdfd4b438bb54baddc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c

index 1628bf55458fcb0bf7d812970d619e815a89c950..23e64a757cfe86a06626a32430dc3919c983e91f 100644 (file)
@@ -855,10 +855,15 @@ int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
 int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id)
 {
-       int ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id);
+       int ret;
 
        lockdep_assert_held(&mvm->mutex);
 
+       if (WARN_ON(sta_id == IWL_MVM_INVALID_STA))
+               return 0;
+
+       ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id);
+
        RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL);
        RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL);
        return ret;