From: Takashi Iwai <tiwai@suse.de>
To: Sinan Turunc <enscrpt@pm.me>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: usx2y: Count completions apart from the URB array length
Date: Mon, 16 Nov 2026 16:40:43 +0100 [thread overview]
Message-ID: <875wxwyebo.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261115121602.151-1-enscrpt@pm.me>
On Sun, 15 Nov 2026 13:16:33 +0100,
Sinan Turunc wrote:
>
> usx2y_rate_set() allocates a snd_usx2y_urb_seq with len set to the
> number of URBs, and i_usx2y_04int() decrements len once per completed
> URB to know when all of them are done. Since len is also the
> __counted_by() bound of the urb[] array, every access to the array after
> the first completion is out of range for UBSAN, and the cleanup loop in
> usx2y_rate_set() trips it on every prepare:
>
> UBSAN: array-index-out-of-bounds in sound/usb/usx2y/usbusx2yaudio.c:694:18
> index 0 is out of range for type 'urb *[*]'
>
> Count the completions in a separate field and leave len as the array
> length.
>
> Tested on 7.3-rc7 with CONFIG_UBSAN_BOUNDS and an emulated US-122 over
> USB/IP: before, the report appears on every prepare; after, a 30 s
> capture stream prepares and runs without it and the rate sequence still
> completes.
>
> Fixes: f5cc9cdfc96f ("ALSA: usx2y: Annotate struct snd_usx2y_urb_seq with __counted_by")
> Signed-off-by: Sinan Turunc <enscrpt@pm.me>
Applied now. Thanks.
Takashi
prev parent reply other threads:[~2026-11-16 15:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 12:16 [PATCH] ALSA: usx2y: Count completions apart from the URB array length Sinan Turunc
2026-11-16 15:40 ` Takashi Iwai [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=875wxwyebo.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=enscrpt@pm.me \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.