Index: sys/dev/usb/usb_subr.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.217 diff -u -p -r1.217 usb_subr.c --- sys/dev/usb/usb_subr.c 4 Dec 2016 10:12:35 -0000 1.217 +++ sys/dev/usb/usb_subr.c 14 Dec 2016 16:14:44 -0000 @@ -611,6 +611,16 @@ usbd_set_config_index(struct usbd_device return err; } len = UGETW(cd.wTotalLength); + if (len == 0) { + printf("%s: bLength %d\n", __func__, cd.bLength); + printf("%s: bDescriptorType %d\n", __func__, cd.bDescriptorType); + printf("%s: bNumInterface %d\n", __func__, cd.bNumInterface); + printf("%s: bConfigurationValue %d\n", __func__, cd.bConfigurationValue); + printf("%s: iConfiguration %d\n", __func__, cd.iConfiguration); + printf("%s: bmAttributes %d\n", __func__, cd.bmAttributes); + printf("%s: bMaxPower %d\n", __func__, cd.bMaxPower); + return USBD_INVAL; + } cdp = kmem_alloc(len, KM_SLEEP); if (cdp == NULL) return USBD_NOMEM;