mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
ALSA: usb-audio: Clamp frame size in implicit-feedback mode
snd_usb_handle_sync_urb() scales received sync packet sizes by the sender's
stride and stores the result directly in out_packet->packet_size[i]. If a
connected USB device sends an oversized sync packet, this frame count can
exceed ep->maxframesize.
The un-clamped frame count then propagates to the playback endpoint queue,
potentially driving packet transfers beyond the endpoint's hardware frame
limits.
Cap the calculated frame count against ep->maxframesize in
snd_usb_handle_sync_urb() to prevent oversized packets from entering the
playback queue.
Fixes: 28acb12014 ("ALSA: usb-audio: use sender stride for implicit feedback")
Cc: stable@vger.kernel.org
Assisted-by: Jetski:Gemini-3.6-Flash
Signed-off-by: Sonali Pradhan <sonalipradhan@google.com>
Link: https://patch.msgid.link/20260728202432.2354994-1-sonalipradhan@google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d0199ae166
commit
8d7a30c50c
|
|
@ -1819,11 +1819,13 @@ static void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
|
|||
|
||||
out_packet->packets = in_ctx->packets;
|
||||
for (i = 0; i < in_ctx->packets; i++) {
|
||||
if (urb->iso_frame_desc[i].status == 0)
|
||||
out_packet->packet_size[i] =
|
||||
if (urb->iso_frame_desc[i].status == 0) {
|
||||
unsigned int frames =
|
||||
urb->iso_frame_desc[i].actual_length / sender->stride;
|
||||
else
|
||||
out_packet->packet_size[i] = min(frames, ep->maxframesize);
|
||||
} else {
|
||||
out_packet->packet_size[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&ep->lock, flags);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user