Skip to content

Commit 70b4db7

Browse files
committed
ALSA: usb-audio: Use the right limit for PCM OOB check
The recent fix commit for addressing the OOB access of PCM URB data buffer caused a regression on Behringer UMC2020HD device, resulting in choppy sound. The fix used ep->max_urb_frames for the upper limit check, and this is no right value to be referred. Use the actual buffer size (ctx->buffer_size) as the upper limit instead, which also avoids the regression on the device above. Fixes: ef5749e ("ALSA: usb-audio: Prevent excessive number of frames") Link: https://bugzilla.kernel.org/show_bug.cgi?id=220997 Link: https://patch.msgid.link/20260121082025.718748-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 930e697 commit 70b4db7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

sound/usb/pcm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,8 @@ static int prepare_playback_urb(struct snd_usb_substream *subs,
15531553

15541554
for (i = 0; i < ctx->packets; i++) {
15551555
counts = snd_usb_endpoint_next_packet_size(ep, ctx, i, avail);
1556-
if (counts < 0 || frames + counts >= ep->max_urb_frames)
1556+
if (counts < 0 ||
1557+
(frames + counts) * stride > ctx->buffer_size)
15571558
break;
15581559
/* set up descriptor */
15591560
urb->iso_frame_desc[i].offset = frames * stride;

0 commit comments

Comments
 (0)