]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
iwlwifi: mvm: fix off by one in iwl_mvm_stat_iterator_all_macs()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 6 Jan 2022 07:18:25 +0000 (10:18 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:58:08 +0000 (13:58 +0200)
[ Upstream commit f1cbb0a8ca9db80c086009c88c71464ac50f50a2 ]

Change the comparison from ">" to ">=" to avoid accessing one element
beyond the end of the ->per_mac_stats[] array.

Fixes: 6324c173ff4a ("iwlwifi: mvm: add support for statistics update version 15")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220106071825.GA5836@kili
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/iwlwifi/mvm/rx.c

index 64446a11ef9805901253ea34f62dca24e62060c3..9a46468bd434568a70b78bd981f98ecaae725342 100644 (file)
@@ -640,7 +640,7 @@ static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac,
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        u16 vif_id = mvmvif->id;
 
-       if (WARN_ONCE(vif_id > MAC_INDEX_AUX, "invalid vif id: %d", vif_id))
+       if (WARN_ONCE(vif_id >= MAC_INDEX_AUX, "invalid vif id: %d", vif_id))
                return;
 
        if (vif->type != NL80211_IFTYPE_STATION)