⬢ DragonFlyBSD Kernel Audit
DF-5487 / 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
 
+/*
+ * Cfg-path control-request timeout bound: uvisor_cfg_close() issues one
+ * synchronous vendor control-IN whose usb_error_t is discarded, and a
+ * 1000 ms timeout lets an in-spec-but-slow (NAK-ing) device block the
+ * synchronous close(2) (usb_proc_mwait) and the unplug drain for the
+ * full second.  Bound it to 250 ms (same bound as the ubsa DF-5476 /
+ * uvscom DF-5449 family fixes).
+ */
+#define	UVISOR_CFG_TIMEOUT			250	/* ms */
+
 struct uvisor_palm_connection_info {
 	uByte	num_ports;
 	uByte	endpoint_numbers_different;
@@ -536,8 +546,8 @@
 	USETW(req.wIndex, 0);
 	USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
 
-	err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
-	    &req, buffer, 0, 1000);
+	err = ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
+	    &req, buffer, 0, UVISOR_CFG_TIMEOUT);
 	if (err) {
 		DPRINTFN(0, "close notification failed, error=%s\n",
 		    usbd_errstr(err));