From: Jiri Slaby <jirislaby@kernel.org>
To: johannes@sipsolutions.net
Cc: linux-kernel@vger.kernel.org,
Vincent Danjean <vdanjean@debian.org>,
1119093@bugs.debian.org, Salvatore Bonaccorso <carnil@debian.org>,
Nick Kossifidis <mickflemm@gmail.com>,
Luis Chamberlain <mcgrof@kernel.org>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH] wifi: ath5k: do not access array OOB
Date: Wed, 19 Nov 2025 08:17:15 +0100 [thread overview]
Message-ID: <543fd250-5ac2-46a4-9c7f-e0ec6550b78d@kernel.org> (raw)
In-Reply-To: <20251119071201.792814-1-jirislaby@kernel.org>
On 19. 11. 25, 8:12, Jiri Slaby (SUSE) wrote:
> Vincent reports:
>> The ath5k driver seems to do an array-index-out-of-bounds access as
>> shown by the UBSAN kernel message:
>> UBSAN: array-index-out-of-bounds in drivers/net/wireless/ath/ath5k/base.c:1741:20
>> index 4 is out of range for type 'ieee80211_tx_rate [4]'
>> ...
>> Call Trace:
>> <TASK>
>> dump_stack_lvl+0x5d/0x80
>> ubsan_epilogue+0x5/0x2b
>> __ubsan_handle_out_of_bounds.cold+0x46/0x4b
>> ath5k_tasklet_tx+0x4e0/0x560 [ath5k]
>> tasklet_action_common+0xb5/0x1c0
>
> It is real. 'ts->ts_final_idx' can be 3 on 5212, so:
> info->status.rates[ts->ts_final_idx + 1].idx = -1;
> with the array defined as:
> struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
> while the size is:
> #define IEEE80211_TX_MAX_RATES 4
> is indeed bogus.
>
> Set this 'idx = -1' sentinel only if the array index is less than the
> array size. As mac80211 will not look at rates beyond the size
> (IEEE80211_TX_MAX_RATES).
>
> Note: The effect of the OOB write is negligible. It just overwrites the
> next member of info->status, i.e. ack_signal.
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Reported-by: Vincent Danjean <vdanjean@debian.org>
> Link: https://lore.kernel.org/all/aQYUkIaT87ccDCin@eldamar.lan
> Closes: https://bugs.debian.org/1119093
I forgot:
Fixes: 6d7b97b23e11 ("ath5k: fix tx status reporting issues")
Cc: stable@vger.kernel.org
Do you want me to resend?
> ---
> Cc: 1119093@bugs.debian.org
> Cc: Salvatore Bonaccorso <carnil@debian.org>
> Cc: Nick Kossifidis <mickflemm@gmail.com>,
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: linux-wireless@vger.kernel.org
> ---
> drivers/net/wireless/ath/ath5k/base.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 4d88b02ffa79..917e1b087924 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -1738,7 +1738,8 @@ ath5k_tx_frame_completed(struct ath5k_hw *ah, struct sk_buff *skb,
> }
>
> info->status.rates[ts->ts_final_idx].count = ts->ts_final_retry;
> - info->status.rates[ts->ts_final_idx + 1].idx = -1;
> + if (ts->ts_final_idx + 1 < IEEE80211_TX_MAX_RATES)
> + info->status.rates[ts->ts_final_idx + 1].idx = -1;
>
> if (unlikely(ts->ts_status)) {
> ah->stats.ack_fail++;
thanks,
--
js
suse labs
prev parent reply other threads:[~2025-11-19 7:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 7:12 [PATCH] wifi: ath5k: do not access array OOB Jiri Slaby (SUSE)
2025-11-19 7:17 ` Jiri Slaby [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=543fd250-5ac2-46a4-9c7f-e0ec6550b78d@kernel.org \
--to=jirislaby@kernel.org \
--cc=1119093@bugs.debian.org \
--cc=carnil@debian.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mickflemm@gmail.com \
--cc=vdanjean@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox