Commit 27a221f4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Kalle Valo

iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()

These should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() to prevent an
out of bounds write on the next line.

Fixes: 79e561f0 ("iwlwifi: mvm: d3: implement RSC command version 5")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarLuca Coelho <luca@coelho.fi>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210831081802.GA9846@kili
parent 24d5f16e
...@@ -360,11 +360,11 @@ static void iwl_mvm_wowlan_get_rsc_v5_data(struct ieee80211_hw *hw, ...@@ -360,11 +360,11 @@ static void iwl_mvm_wowlan_get_rsc_v5_data(struct ieee80211_hw *hw,
if (sta) { if (sta) {
rsc = data->rsc->ucast_rsc; rsc = data->rsc->ucast_rsc;
} else { } else {
if (WARN_ON(data->gtks > ARRAY_SIZE(data->gtk_ids))) if (WARN_ON(data->gtks >= ARRAY_SIZE(data->gtk_ids)))
return; return;
data->gtk_ids[data->gtks] = key->keyidx; data->gtk_ids[data->gtks] = key->keyidx;
rsc = data->rsc->mcast_rsc[data->gtks % 2]; rsc = data->rsc->mcast_rsc[data->gtks % 2];
if (WARN_ON(key->keyidx > if (WARN_ON(key->keyidx >=
ARRAY_SIZE(data->rsc->mcast_key_id_map))) ARRAY_SIZE(data->rsc->mcast_key_id_map)))
return; return;
data->rsc->mcast_key_id_map[key->keyidx] = data->gtks % 2; data->rsc->mcast_key_id_map[key->keyidx] = data->gtks % 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment