summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2026-02-25 09:52:28 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-03-25 11:02:53 +0100
commitbdfdbc7a800b57319a58ed5e540780174efe34e6 (patch)
treed5742a550e7c82dabfd5d70534580f66967f8dfd /sound
parent4a07d6ce46836bb2cd96b0f5bc14140fda9dc334 (diff)
downloadlinux-bdfdbc7a800b57319a58ed5e540780174efe34e6.tar.gz
linux-bdfdbc7a800b57319a58ed5e540780174efe34e6.tar.bz2
linux-bdfdbc7a800b57319a58ed5e540780174efe34e6.zip
ALSA: usb-audio: Cap the packet size pre-calculations
[ Upstream commit 7fe8dec3f628e9779f1631576f8e693370050348 ] We calculate the possible packet sizes beforehand for adaptive and synchronous endpoints, but we didn't take care of the max frame size for those pre-calculated values. When a device or a bus limits the packet size, a high sample rate or a high number of channels may lead to the packet sizes that are larger than the given limit, which results in an error from the USB core at submitting URBs. As a simple workaround, just add the sanity checks of pre-calculated packet sizes to have the upper boundary of ep->maxframesize. Fixes: f0bd62b64016 ("ALSA: usb-audio: Improve frames size computation") Link: https://bugzilla.kernel.org/show_bug.cgi?id=221076 Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260225085233.316306-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/endpoint.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 86a8624e8781..8f486c5c938f 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -1392,6 +1392,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
goto unlock;
}
+ ep->packsize[0] = min(ep->packsize[0], ep->maxframesize);
+ ep->packsize[1] = min(ep->packsize[1], ep->maxframesize);
+
/* calculate the frequency in 16.16 format */
ep->freqm = ep->freqn;
ep->freqshift = INT_MIN;