NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/52383 (Crash when connecting specific USB devices)



 > panic: kernel diagnostic assertion "requested_size > 0" failed: file "[...]/src/sys/kern/subr_kmem.c", line 261

Should be handled better by the diff


Why this is happening is a different subject. Can you get usbdebug/*hcidebug for the HCD the device is attached to please?

Thanks,
Nick

Index: sys/dev/usb/usb_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.221
diff -u -p -r1.221 usb_subr.c
--- sys/dev/usb/usb_subr.c	28 Oct 2017 00:37:12 -0000	1.221
+++ sys/dev/usb/usb_subr.c	22 Nov 2017 13:00:55 -0000
@@ -609,6 +609,11 @@ usbd_set_config_index(struct usbd_device
 		return err;
 	}
 	len = UGETW(cd.wTotalLength);
+	if (len == 0) {
+		DPRINTF("zero length descriptor", 0, 0, 0, 0);
+		return USBD_INVAL;
+	}
+		
 	cdp = kmem_alloc(len, KM_SLEEP);
 
 	/* Get the full descriptor.  Try a few times for slow devices. */


Home | Main Index | Thread Index | Old Index