Commit 0de19d5a authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Johannes Berg
Browse files

wifi: iwlegacy: Check rate_idx range after addition



Limit rate_idx to IL_LAST_OFDM_RATE for 5GHz band for thinkable case
the index is incorrect.

Reported-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
Reported-by: default avatarAlexei Safin <a.safin@rosa.ru>
Signed-off-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Reviewed-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
Link: https://patch.msgid.link/20250525144524.GA172583@wp.pl


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 62deb67f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1575,8 +1575,11 @@ il4965_tx_cmd_build_rate(struct il_priv *il,
	    || rate_idx > RATE_COUNT_LEGACY)
		rate_idx = rate_lowest_index(&il->bands[info->band], sta);
	/* For 5 GHZ band, remap mac80211 rate indices into driver indices */
	if (info->band == NL80211_BAND_5GHZ)
	if (info->band == NL80211_BAND_5GHZ) {
		rate_idx += IL_FIRST_OFDM_RATE;
		if (rate_idx > IL_LAST_OFDM_RATE)
			rate_idx = IL_LAST_OFDM_RATE;
	}
	/* Get PLCP rate for tx_cmd->rate_n_flags */
	rate_plcp = il_rates[rate_idx].plcp;
	/* Zero out flags for this packet */