* Re: [PATCH] ALSA: ua101: reject mismatched capture/playback packet sizes [not found] <CANd6Td+b6ituLFzkhvX09vricCY541fQapNOk3rTa=74zWA5LA@mail.gmail.com> @ 2026-11-12 12:37 ` Takashi Iwai 2026-11-12 12:55 ` London grad 0 siblings, 1 reply; 4+ messages in thread From: Takashi Iwai @ 2026-11-12 12:37 UTC (permalink / raw) To: London grad Cc: clemens, linux-sound, tiwai, perex, Xiang Mei, co+24304d323d28f156, stable On Thu, 12 Nov 2026 10:25:39 +0100, London grad wrote: > Hello all > > This patch may have broken ua-101? > > Kernel 6.8.0-146 still works for me > > In kernel 6.8.0-149 my UA-1000 fails with > > `snd-ua101` rejects the device during probe at every physical sample rate > setting (44.1, 48, 88.2, and 96 kHz), leaving the interface unregistered in > ALSA. > > ### Relevant `dmesg` Output > [ 2622.796887] usb 3-3: new high-speed USB device number 5 using xhci_hcd > [ 2622.928793] usb 3-3: New USB device found, idVendor=0582, idProduct=0044, > bcdDevice= 1.07 > [ 2622.928798] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber > =3 > [ 2622.928800] usb 3-3: Product: UA-1000 > [ 2622.928801] usb 3-3: Manufacturer: EDIROL > [ 2622.928802] usb 3-3: SerialNumber: ZT02743 > [ 2622.934792] usb 3-3: playback packet size 560 too small for 15 capture > frames > > Submitted bug report here > https://bugzilla.kernel.org/show_bug.cgi?id=222261 Could you verify that just reverting the commit fixes your problem? It's quite possible that this patch is the cause, but just to be sure. thanks, Takashi ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: ua101: reject mismatched capture/playback packet sizes 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 0 siblings, 1 reply; 4+ messages in thread From: London grad @ 2026-11-12 12:55 UTC (permalink / raw) To: Takashi Iwai Cc: clemens, linux-sound, tiwai, perex, Xiang Mei, co+24304d323d28f156, stable Thank you very much for the reply I don't currently have a way to revert the commit, but can confirm that the interface works fine when booting with older kernel 6.8.0-146 from Ubuntu. The 6.8.0-149.149 series were rolled out earlier this month, I updated last night to -149 and this morning the interface failed to initialise. Best regards On Thu, Nov 12, 2026 at 12:37 PM Takashi Iwai <tiwai@suse.de> wrote: > > On Thu, 12 Nov 2026 10:25:39 +0100, > London grad wrote: > > Hello all > > > > This patch may have broken ua-101? > > > > Kernel 6.8.0-146 still works for me > > > > In kernel 6.8.0-149 my UA-1000 fails with > > > > `snd-ua101` rejects the device during probe at every physical sample rate > > setting (44.1, 48, 88.2, and 96 kHz), leaving the interface unregistered in > > ALSA. > > > > ### Relevant `dmesg` Output > > [ 2622.796887] usb 3-3: new high-speed USB device number 5 using xhci_hcd > > [ 2622.928793] usb 3-3: New USB device found, idVendor=0582, idProduct=0044, > > bcdDevice= 1.07 > > [ 2622.928798] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber > > =3 > > [ 2622.928800] usb 3-3: Product: UA-1000 > > [ 2622.928801] usb 3-3: Manufacturer: EDIROL > > [ 2622.928802] usb 3-3: SerialNumber: ZT02743 > > [ 2622.934792] usb 3-3: playback packet size 560 too small for 15 capture > > frames > > > > Submitted bug report here > > https://bugzilla.kernel.org/show_bug.cgi?id=222261 > > Could you verify that just reverting the commit fixes your problem? > It's quite possible that this patch is the cause, but just to be sure. > > > thanks, > > Takashi ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ALSA: ua101: clamp playback packet sizes instead of rejecting UA-1000 2026-11-12 12:55 ` London grad @ 2026-11-27 6:46 ` Masanori Suto 2026-11-27 17:36 ` Takashi Iwai 0 siblings, 1 reply; 4+ messages in thread From: Masanori Suto @ 2026-11-27 6:46 UTC (permalink / raw) To: tiwai@suse.de Cc: londongrad@gmail.com, xmei5@asu.edu, clemens@ladisch.de, perex@perex.cz, linux-sound@vger.kernel.org, stable@vger.kernel.org, regressions@lists.linux.dev, Masanori Suto 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 sound/usb/misc/ua101.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c index bd8e0ed..196a588 100644 --- a/sound/usb/misc/ua101.c +++ b/sound/usb/misc/ua101.c @@ -371,7 +371,7 @@ static void capture_urb_complete(struct urb *urb) struct ua101_urb *ua_urb = urb->context; struct ua101 *ua = ua_urb->ua; struct ua101_stream *stream = &ua->capture; - unsigned int frames, write_ptr; + unsigned int frames, max_frames, write_ptr; bool do_period_elapsed; int err; @@ -402,6 +402,21 @@ static void capture_urb_complete(struct urb *urb) goto stream_stopped; } + /* + * The playback stream reuses this packet size, but its + * URB buffers hold only playback.max_packet_bytes. The + * capture packet size comes from the device, so clamp it + * to what fits into one playback packet. + */ + max_frames = ua->playback.max_packet_bytes / + ua->playback.frame_bytes; + if (unlikely(frames > max_frames)) { + dev_warn_ratelimited(&ua->dev->dev, + "capture packet of %u frames clamped\n", + frames); + frames = max_frames; + } + /* append packet size to FIFO */ write_ptr = ua->rate_feedback_start; add_with_wraparound(ua, &write_ptr, ua->rate_feedback_count); @@ -1031,12 +1046,17 @@ static int detect_usb_format(struct ua101 *ua) ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, usb_endpoint_num(epd)); ua->playback.max_packet_bytes = usb_endpoint_maxp(epd); - if (ua->capture.max_packet_bytes / ua->capture.frame_bytes * + /* + * capture_urb_complete() clamps the packet sizes passed to the playback + * stream to playback.max_packet_bytes, so only the nominal rate must + * fit here. wMaxPacketSize of the capture endpoint may legitimately + * be larger (e.g. UA-1000). + */ + if (DIV_ROUND_UP(ua->rate, ua->packets_per_second) * ua->playback.frame_bytes > ua->playback.max_packet_bytes) { dev_err(&ua->dev->dev, - "playback packet size %u too small for %u capture frames\n", - ua->playback.max_packet_bytes, - ua->capture.max_packet_bytes / ua->capture.frame_bytes); + "playback packet size %u too small for %u Hz\n", + ua->playback.max_packet_bytes, ua->rate); return -ENXIO; } return 0; -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: ua101: clamp playback packet sizes instead of rejecting UA-1000 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 0 siblings, 0 replies; 4+ messages in thread From: Takashi Iwai @ 2026-11-27 17:36 UTC (permalink / raw) To: Masanori Suto Cc: tiwai@suse.de, londongrad@gmail.com, xmei5@asu.edu, clemens@ladisch.de, perex@perex.cz, linux-sound@vger.kernel.org, stable@vger.kernel.org, regressions@lists.linux.dev 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-27 17:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox