Skip to content

Commit 8775fa6

Browse files
tiwaigregkh
authored andcommitted
ALSA: usb-audio: Evaluate packsize caps at the right place
commit 52521e8 upstream. We introduced the upper bound checks of the packet sizes by the ep->maxframesize for avoiding the URB submission errors. However, the check was applied at an incorrect place in the function snd_usb_endpoint_set_params() where ep->maxframesize isn't defined yet; the value is defined at a bit later position. So this ended up with a failure at the first run while the second run works. For fixing it, move the check at the correct place, right after the calculation of ep->maxframesize in the same function. Fixes: 7fe8dec ("ALSA: usb-audio: Cap the packet size pre-calculations") Link: https://bugzilla.kernel.org/show_bug.cgi?id=221292 Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20260410143220.1676344-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e3a0ebd commit 8775fa6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sound/usb/endpoint.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,9 +1397,6 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
13971397
goto unlock;
13981398
}
13991399

1400-
ep->packsize[0] = min(ep->packsize[0], ep->maxframesize);
1401-
ep->packsize[1] = min(ep->packsize[1], ep->maxframesize);
1402-
14031400
/* calculate the frequency in 16.16 format */
14041401
ep->freqm = ep->freqn;
14051402
ep->freqshift = INT_MIN;
@@ -1426,6 +1423,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
14261423
ep->maxframesize = ep->maxpacksize / ep->cur_frame_bytes;
14271424
ep->curframesize = ep->curpacksize / ep->cur_frame_bytes;
14281425

1426+
ep->packsize[0] = min(ep->packsize[0], ep->maxframesize);
1427+
ep->packsize[1] = min(ep->packsize[1], ep->maxframesize);
1428+
14291429
err = update_clock_ref_rate(chip, ep);
14301430
if (err >= 0) {
14311431
ep->need_setup = false;

0 commit comments

Comments
 (0)