Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Masanori Suto <suto@geek-masa.com>
Cc: "tiwai@suse.de" <tiwai@suse.de>,
	"londongrad@gmail.com" <londongrad@gmail.com>,
	"xmei5@asu.edu" <xmei5@asu.edu>,
	"clemens@ladisch.de" <clemens@ladisch.de>,
	"perex@perex.cz" <perex@perex.cz>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"regressions@lists.linux.dev" <regressions@lists.linux.dev>
Subject: Re: [PATCH] ALSA: ua101: clamp playback packet sizes instead of rejecting UA-1000
Date: Fri, 27 Nov 2026 18:36:31 +0100	[thread overview]
Message-ID: <87a4mumb1c.wl-tiwai@suse.de> (raw)
In-Reply-To: <010101a21bc150d7-627da1ea-4ebf-499d-9ae0-edf88db3e063-000000@us-west-2.amazonses.com>

On Fri, 27 Nov 2026 07:46:23 +0100,
Masanori Suto wrote:
> 
> Commit 86f86e6fdedc ("ALSA: ua101: reject mismatched capture/playback
> packet sizes") rejects a device at probe time when a capture packet of
> wMaxPacketSize bytes would carry more frames than fit into a playback
> packet.  It assumed that genuine hardware declares proportional packet
> sizes, but the UA-1000 does not:
> 
>   capture  EP 0x81: 12 ch x 4 bytes, wMaxPacketSize 720 -> 15 frames
>   playback EP 0x02: 10 ch x 4 bytes, wMaxPacketSize 560 -> 14 frames
> 
> so the UA-1000 now fails to probe with
> 
>   playback packet size 560 too small for 15 capture frames
> 
> In practice the device sends about rate/8000 frames per packet at high
> speed (6 at 48 kHz, 12 at 96 kHz), which always fits the playback
> packet.
> 
> The out-of-bounds write has a single source: capture_urb_complete()
> stores the received frame count in rate_feedback[], and both
> start_usb_playback() and playback_work() take their packet sizes only
> from that FIFO.  Clamp the value there to what fits into one playback
> packet, so the playback URB buffer cannot be overrun whatever the
> descriptors say, and relax the probe check to require only that one
> packet at the nominal rate fits.
> 
> Tested on a UA-1000 (0582:0044): the device probes again, and playback
> and capture both work.
> 
> Fixes: 86f86e6fdedc ("ALSA: ua101: reject mismatched capture/playback packet sizes")
> Cc: stable@vger.kernel.org
> Reported-by: London grad <londongrad@gmail.com>
> Closes: https://lore.kernel.org/all/CANd6Td+b6ituLFzkhvX09vricCY541fQapNOk3rTa=74zWA5LA@mail.gmail.com/
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222261
> Signed-off-by: Suto, Masanori <suto@geek-masa.com>
> ---
> Hi Takashi,
> 
> To answer your question earlier in this thread: on my UA-1000
> (0582:0044, bcdDevice 1.07), reverting 86f86e6fdedc alone makes the
> device work again. It is registered in /proc/asound/cards, and playback
> and capture both work. Without the revert it fails to probe with
> "playback packet size 560 too small for 15 capture frames", as in the
> earlier report. So the commit is confirmed as the cause.
> 
> A plain revert would reopen CVE-2026-98741, so this patch keeps the
> protection by clamping the packet size where it is produced instead of
> rejecting the device. With this patch applied, playback and capture also
> both work. Tested on linux-zen 7.3.6-zen1; sound/usb/misc/ua101.c there
> is identical to mainline.
> 
> To check that the 15-frame worst case does not happen on real hardware,
> I captured the isochronous traffic with usbmon: 60 s of simultaneous
> playback and capture at each rate the UA-1000 supports, about 480000
> packets each. Frames per packet, from the actual capture length
> (EP 0x81) and the submitted playback length (EP 0x02):
> 
>   rate       capture frames per packet           max
>   44.1 kHz    5: 48.76%   6: 51.24%                6
>   48 kHz      5:  1.14%   6: 97.74%   7: 1.12%     7
>   88.2 kHz   10:  1.04%  11: 95.45%  12: 3.52%    12
>   96 kHz     11:  0.08%  12: 99.86%  13: 0.06%    13
> 
> Playback used exactly the same distribution at every rate. The maximum
> is 13 frames at 96 kHz, which fits the 14-frame playback packet. The
> 15 frames assumed from wMaxPacketSize never occur: the device stays
> within one frame of rate/8000. The clamp warning added by this patch
> never appeared in the kernel log during these runs.
> 
> The same breakage was also reported on LinuxMusicians:
> https://linuxmusicians.com/viewtopic.php?p=189180
> 
> #regzbot ^introduced: 86f86e6fdedc

Applied now.  Thanks.


Takashi

      reply	other threads:[~2026-11-27 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANd6Td+b6ituLFzkhvX09vricCY541fQapNOk3rTa=74zWA5LA@mail.gmail.com>
2026-11-12 12:37 ` [PATCH] ALSA: ua101: reject mismatched capture/playback packet sizes Takashi Iwai
2026-11-12 12:55   ` London grad
2026-11-27  6:46     ` [PATCH] ALSA: ua101: clamp playback packet sizes instead of rejecting UA-1000 Masanori Suto
2026-11-27 17:36       ` 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=87a4mumb1c.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=clemens@ladisch.de \
    --cc=linux-sound@vger.kernel.org \
    --cc=londongrad@gmail.com \
    --cc=perex@perex.cz \
    --cc=regressions@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=suto@geek-masa.com \
    --cc=xmei5@asu.edu \
    /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