⬢ DragonFlyBSD Kernel Audit
DF-5488 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/u4b/serial/uvisor.c	2026-10-06 08:47:30.761425160 +0000
+++ b/sys/bus/u4b/serial/uvisor.c	2026-10-06 08:47:30.777424955 +0000
@@ -145,6 +145,16 @@
 #define	UVISOR_GET_PALM_INFORMATION		0x04
 #define	UVISOR_GET_PALM_INFORMATION_LEN		0x44
 
+/*
+ * Attach-path control-request timeout bound: uvisor_init() chains up to
+ * two synchronous EP0 requests (VISOR connection info, PALM4 palm info,
+ * PALM35 config+interface) at the 5000 ms USB_DEFAULT_TIMEOUT, so an
+ * in-spec-but-slow (NAK-ing) device pins the per-bus USB explore thread
+ * for up to ~10 s during attach.  Bound each request to 250 ms instead
+ * (same bound as the uplcom DF-5407 family fix).
+ */
+#define	UVISOR_INIT_TIMEOUT			250	/* ms */
+
 struct uvisor_palm_connection_info {
 	uByte	num_ports;
 	uByte	endpoint_numbers_different;
@@ -386,7 +396,7 @@
 		USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
 		err = usbd_do_request_flags(udev, NULL,
 		    &req, &coninfo, USB_SHORT_XFER_OK,
-		    &actlen, USB_DEFAULT_TIMEOUT);
+		    &actlen, UVISOR_INIT_TIMEOUT);
 
 		if (err) {
 			goto done;
@@ -439,7 +449,7 @@
 
 		err = usbd_do_request_flags
 		    (udev, NULL, &req, &pconinfo, USB_SHORT_XFER_OK,
-		    &actlen, USB_DEFAULT_TIMEOUT);
+		    &actlen, UVISOR_INIT_TIMEOUT);
 
 		if (err) {
 			goto done;
@@ -479,7 +489,8 @@
 		USETW(req.wIndex, 0);
 		USETW(req.wLength, 1);
 
-		err = usbd_do_request(udev, NULL, &req, buffer);
+		err = usbd_do_request_flags(udev, NULL, &req, buffer,
+		    0, NULL, UVISOR_INIT_TIMEOUT);
 		if (err) {
 			goto done;
 		}
@@ -490,7 +501,8 @@
 		USETW(req.wValue, 0);
 		USETW(req.wIndex, 0);
 		USETW(req.wLength, 1);
-		err = usbd_do_request(udev, NULL, &req, buffer);
+		err = usbd_do_request_flags(udev, NULL, &req, buffer,
+		    0, NULL, UVISOR_INIT_TIMEOUT);
 		if (err) {
 			goto done;
 		}