]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: usb-audio: Fix missing unlock at error path of maxpacksize check
authorTakashi Iwai <tiwai@suse.de>
Wed, 26 Nov 2025 10:08:31 +0000 (11:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Dec 2025 10:43:36 +0000 (11:43 +0100)
The recent backport of the upstream commit 05a1fc5efdd8 ("ALSA:
usb-audio: Fix potential overflow of PCM transfer buffer") on the
older stable kernels like 6.12.y was broken since it doesn't consider
the mutex unlock, where the upstream code manages with guard().
In the older code, we still need an explicit unlock.

This is a fix that corrects the error path, applied only on old stable
trees.

Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://lore.kernel.org/aSWtH0AZH5+aeb+a@duo.ucw.cz
Fixes: 98e9d5e33bda ("ALSA: usb-audio: Fix potential overflow of PCM transfer buffer")
Reviewed-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/usb/endpoint.c

index 7238f65cbcfffbda34f5fa6687dd86ecfece735e..aa201e4744bf69a624a6619ab213ab4a2f647904 100644 (file)
@@ -1389,7 +1389,8 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
        if (ep->packsize[1] > ep->maxpacksize) {
                usb_audio_dbg(chip, "Too small maxpacksize %u for rate %u / pps %u\n",
                              ep->maxpacksize, ep->cur_rate, ep->pps);
-               return -EINVAL;
+               err = -EINVAL;
+               goto unlock;
        }
 
        /* calculate the frequency in 16.16 format */