Skip to contentSkip to conversation

ALSA: usb-audio: Fix missing unlock at error path of maxpacksize check

PATCH New Wentao Guan 1 participant 1 message Feb 4 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ALSA: usb-audio: Fix missing unlock at error path of maxpacksize check

From: Takashi Iwai <[email protected]>

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.

Fixes 98e9d5e33bda ("ALSA: usb-audio: Fix potential overflow of PCM transfer buffer")
(cherry picked from commit fdf0dc82eb60091772ecea73cbc5a8fb7562fc45)

---
changelog v2:
reformat from v6.6.121
---

---
 sound/usb/endpoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/endpoint.c +2 -1
index b05ad2eb623db..17ae74b067c5e 100644
@@ -1386,7 +1386,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 */
Signature · 1 line
2.20.1