DragonFlyBSD Kernel Audit
DF-1004 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/u4b/usb_device.c b/sys/bus/u4b/usb_device.c
--- a/sys/bus/u4b/usb_device.c
+++ b/sys/bus/u4b/usb_device.c
@@ -938,7 +938,12 @@
 		goto done;
 	}
 	if (iface->alt_index != alt_index) {
-		/* the alternate setting does not exist */
+		/*
+		 * DF-1004: the alternate setting does not exist, but the
+		 * INIT pre-pass already zeroed the endpoints.  Re-parse the
+		 * previous (still-valid) alternate setting to restore them.
+		 */
+		usb_config_parse(udev, iface_index, iface->alt_index);
 		err = USB_ERR_INVAL;
 		goto done;
 	}