Skip to content

Commit 127f021

Browse files
CassivsGabriellisgregkh
authored andcommitted
ALSA: usb-audio: Fix UAC3 cluster descriptor size check
commit 26265dd upstream. The UAC3 cluster descriptor length check in snd_usb_get_audioformat_uac3()was added to make sure that the buffer is large enough for a struct uac3_cluster_header_descriptor before the returned data is cast and used. However, the check uses sizeof(cluster), where cluster is a pointer, not the size of the descriptor header. This makes the validation depend on the architecture pointer size and does not match the intended object size. Check against sizeof(*cluster) instead. Fixes: fb4e2a6 ("ALSA: usb-audio: Fix out-of-bounds read in snd_usb_get_audioformat_uac3()") Cc: stable@vger.kernel.org Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com> Link: https://patch.msgid.link/20260424-alsa-usb-uac3-cluster-size-v1-1-99a5808898a3@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4e0ee23 commit 127f021

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/usb/stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
998998
* and request Cluster Descriptor
999999
*/
10001000
wLength = le16_to_cpu(hc_header.wLength);
1001-
if (wLength < sizeof(cluster))
1001+
if (wLength < sizeof(*cluster))
10021002
return NULL;
10031003
cluster = kzalloc(wLength, GFP_KERNEL);
10041004
if (!cluster)

0 commit comments

Comments
 (0)