Index | Thread | Search

From:
Andrew Kloet <andrew@kloet.net>
Subject:
uaudio(4): dynamic feature unit control size for UAC2
To:
tech@openbsd.org
Date:
Tue, 10 Nov 2026 18:37:33 -0500

Download raw body.

Thread
Hello tech@

While attaching a 'Teenage Engineering EP-136' audio interface...
uaudio(4) uaudio_process_unit() fails feature unit parsing.

Under UAUDIO_AC_FEATURE, the driver hardcodes size = 4 for UAUDIO_V2.
However, both UAC1/2 specs read bControlSize from the descriptor.
Hardcoding size = 4 causes uaudio_getnum() to overrun on devices whose
feature units specify a different control size.

Fetching bControlSize dynamically for both V1 and V2 resolves the issue.

OK?

Andrew

Index: uaudio.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uaudio.c,v
diff -u -p -r1.189 uaudio.c
--- uaudio.c	24 Sep 2026 13:57:25 -0000	1.189
+++ uaudio.c	10 Nov 2026 23:31:05 -0000
@@ -1473,15 +1473,10 @@ uaudio_process_unit(struct uaudio_softc 
 		s->src_next = u->src_list;
 		u->src_list = s;
 		u->nch = s->nch;
-		switch (sc->version) {
-		case UAUDIO_V1:
-			if (!uaudio_getnum(&p, 1, &size))
-				return 0;
-			break;
-		case UAUDIO_V2:
-			size = 4;
-			break;
-		}
+
+		if (!uaudio_getnum(&p, 1, &size))
+			return 0;
+
 		DPRINTF("%02d: feature id = %d, nch = %d, size = %d\n",
 		    u->id, id, u->nch, size);