[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5woqb2ipm4scei365wlo4rupczolhwtbwnw2djhkvi6qcrz2q2@eykv3a3v62lu>
Date: Tue, 27 May 2025 22:17:13 +0300
From: Fedor Pchelkin <pchelkin@...ras.ru>
To: Stanislaw Gruszka <stf_xl@...pl>
Cc: Johannes Berg <johannes@...solutions.net>,
Alexei Safin <a.safin@...a.ru>, lvc-project@...uxtesting.org, netdev@...r.kernel.org,
Kalle Valo <kvalo@...nel.org>, linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH v2] wifi: iwlegacy: Check rate_idx range after addition
On Sun, 25. May 16:45, Stanislaw Gruszka wrote:
> Limit rate_idx to IL_LAST_OFDM_RATE for 5GHz band for thinkable case
> the index is incorrect.
>
> Reported-by: Fedor Pchelkin <pchelkin@...ras.ru>
> Reported-by: Alexei Safin <a.safin@...a.ru>
> Signed-off-by: Stanislaw Gruszka <stf_xl@...pl>
> ---
> v1 -> v2:
> - just add check one possible case the index could be incorrect,
> instead of doing broader changes.
>
> drivers/net/wireless/intel/iwlegacy/4965-mac.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> index dc8c408902e6..4d2148147b94 100644
> --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> @@ -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 */
> --
> 2.25.4
>
Thanks, Stanislaw!
To my mind, it looks reasonable. FWIW,
Reviewed-by: Fedor Pchelkin <pchelkin@...ras.ru>
Powered by blists - more mailing lists