Skip to contentSkip to conversation

usb: gadget: f_uac1: fix ac_header_desc in SS descriptor list

PATCH New Paritosh Potukuchi 1 participant 1 message Aug 1 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: f_uac1: fix ac_header_desc in SS descriptor list

ac_header_desc is a pointer to a dynamically allocated uac1_ac_header_descriptor. The SS descriptor list incorrectly stores &ac_header_desc, which is the address of the pointer variable rather than the descriptor itself.

usb_copy_descriptors() interprets the entry as a USB descriptor header, which can lead to a global-out-of-bounds read.

Store ac_header_desc instead of &ac_header_desc.

Fixes 0591bc236015 ("usb: gadget: add f_uac1 variant based on a new u_audio api")
Reported-by [email protected]
---
 drivers/usb/gadget/function/f_uac1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_uac1.c +1 -1
index 85c502e98f57..95d53ac8cedb 100644
@@ -332,7 +332,7 @@ static struct usb_ss_ep_comp_descriptor ss_as_in_ep_desc_comp = {
 
 static struct usb_descriptor_header *f_audio_ss_desc[] = {
 	(struct usb_descriptor_header *)&ac_interface_desc,
-	(struct usb_descriptor_header *)&ac_header_desc,
+	(struct usb_descriptor_header *)ac_header_desc,
 
 	(struct usb_descriptor_header *)&usb_out_it_desc,
 	(struct usb_descriptor_header *)&io_out_ot_desc,
Signature · 1 line
2.54.0