From: Jiri Slaby <jirislaby@kernel.org>
To: Salvatore Bonaccorso <carnil@debian.org>,
Nick Kossifidis <mickflemm@gmail.com>,
Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Vincent Danjean <vdanjean@debian.org>,
1119093@bugs.debian.org
Subject: Re: UBSAN array-index-out-of-bounds in ath5k driver
Date: Mon, 3 Nov 2025 08:00:48 +0100 [thread overview]
Message-ID: <791a9e59-7819-4d63-b737-65ff1de6d73d@kernel.org> (raw)
In-Reply-To: <aQYUkIaT87ccDCin@eldamar.lan>
Hi,
On 01. 11. 25, 15:09, Salvatore Bonaccorso wrote:
> In Debian, https://bugs.debian.org/1119093, Vincent Danjean reported
> the following:
>> The ath5k driver seems to do an array-index-out-of-bounds access
>> as shown by the UBSAN kernel message.
>> [ 17.954484] ------------[ cut here ]------------
>> [ 17.954487] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.16.3/drivers/net/wireless/ath/ath5k/base.c:1741:20
>> [ 17.955289] index 4 is out of range for type 'ieee80211_tx_rate [4]'
>> [ 17.956134] CPU: 1 UID: 0 PID: 1745 Comm: 16 Not tainted 6.16.3+deb13-amd64 #1 PREEMPT(lazy) Debian 6.16.3-1~bpo13+1
>> [ 17.956137] Hardware name: Gigabyte Technology Co., Ltd. H67A-UD3H-B3/H67A-UD3H-B3, BIOS F8 03/27/2012
>> [ 17.956139] Call Trace:
>> [ 17.956142] <TASK>
>> [ 17.956145] dump_stack_lvl+0x5d/0x80
>> [ 17.956154] ubsan_epilogue+0x5/0x2b
>> [ 17.956158] __ubsan_handle_out_of_bounds.cold+0x46/0x4b
>> [ 17.956162] ath5k_tasklet_tx+0x4e0/0x560 [ath5k]
>> [ 17.956173] tasklet_action_common+0xb5/0x1c0
>> [ 17.956178] handle_softirqs+0xdf/0x320
>> [ 17.956181] __irq_exit_rcu+0xbc/0xe0
>> [ 17.956184] common_interrupt+0x47/0xa0
>> [ 17.956188] asm_common_interrupt+0x26/0x40
>> [ 17.956191] RIP: 0033:0x7f4fa439067d
>> [ 17.956204] Code: 0f b6 14 16 45 85 c0 74 01 92 29 d0 c3 48 8d 3c 07 48 8d 34 0e 45 85 c0 74 03 48 87 f7 48 0f bc d2 49 29 d3 76 0b 0f b6 0c 16 <0f> b6 04 17 29 c8 c3 31 c0 c3 66 0f 1f 84 00 00 00 00 00 0f b6 0e
>> [ 17.956206] RSP: 002b:00007ffd8cc32f08 EFLAGS: 00000212
>> [ 17.956209] RAX: 0000000000000020 RBX: 0000556dfab414a0 RCX: 0000000000000070
>> [ 17.956210] RDX: 000000000000000d RSI: 00007f4fa4b7a05f RDI: 0000556dfab414a0
>> [ 17.956211] RBP: 00007f4fa4b7a05f R08: 0000000000000400 R09: 0000000000000008
>> [ 17.956213] R10: fffffffffffff4b8 R11: 000000000000000e R12: 000000000000001b
>> [ 17.956214] R13: 0000556dfab412c0 R14: 00007ffd8cc32f80 R15: 00007f4fa4b79eaf
>> [ 17.956217] </TASK>
>> [ 17.956217] ---[ end trace ]---
>>
>> It occurs once at each boot.
>> According to
>> https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable/+blame/master/drivers/net/wireless/ath/ath5k/base.c
>> the line of code has not changed for about 15 years.
>> And I'm using this driver for more than 10 years.
>> So, the array-index-out-of-bounds does not seem to
>> have hard consequences for now (by luck?)
>
> Does that ring any bell?
No, but it is real. ts_final_idx is at most 3 on 5212, so:
info->status.rates[ts->ts_final_idx + 1].idx = -1;
with:
struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
and:
#define IEEE80211_TX_MAX_RATES 4
is indeed bogus.
IMO we should just *not* set idx = -1 if ts->ts_final_idx is >= 3. As
mac80211 won't look at rates beyond IEEE80211_TX_MAX_RATES.
FWIW, the effect of the UB is it just overwrites the next member of
info->status, i.e. ack_signal.
thanks,
--
js
suse labs
next prev parent reply other threads:[~2025-11-03 7:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-01 14:09 Salvatore Bonaccorso
2025-11-03 7:00 ` Jiri Slaby [this message]
2025-11-03 7:04 ` Jiri Slaby
2025-11-03 7:26 ` Vincent Danjean
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=791a9e59-7819-4d63-b737-65ff1de6d73d@kernel.org \
--to=jirislaby@kernel.org \
--cc=1119093@bugs.debian.org \
--cc=carnil@debian.org \
--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
all inboxes | Powered by JetHome®