Skip to contentSkip to conversation

ALSA: usb-audio: Fix size validation in convert_chmap_v3()

PATCH In review Dan Carpenter 2 participants 2 messages Aug 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Fix size validation in convert_chmap_v3()

The "p" pointer is void so sizeof(*p) is 1. The intent was to check sizeof(*cs_desc), which is 3, instead.

Fixes ecfd41166b72 ("ALSA: usb-audio: Validate UAC3 cluster segment descriptors")
---
 sound/usb/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/stream.c +1 -1
index acf3dc2d79e0..5c235a5ba7e1 100644
@@ -349,7 +349,7 @@ snd_pcm_chmap_elem *convert_chmap_v3(struct uac3_cluster_header_descriptor
 		u16 cs_len;
 		u8 cs_type;
 
-		if (len < sizeof(*p))
+		if (len < sizeof(*cs_desc))
 			break;
 		cs_len = le16_to_cpu(cs_desc->wLength);
 		if (len < cs_len)
Signature · 1 line
2.47.2
#1 lore raw
Quoted 6 lines · Dan Carpenter

The "p" pointer is void so sizeof(*p) is 1. The intent was to check sizeof(*cs_desc), which is 3, instead.

Fixes ecfd41166b72 ("ALSA: usb-audio: Validate UAC3 cluster segment descriptors")

Applied now. Thanks.

Takashi