Hi Laurent, > On 09/24/2010 05:09 PM, Laurent Pinchart wrote: >> On 09/24/2010 04:31 PM, Laurent Pinchart wrote: >>>> [PATCH] USB gadget: check descriptors pointer before dereferencing >>>> >>>> Signed-off-by: Holger Brunck <holger.brunck@xxxxxxxxxxx> >>>> --- >>>> >>>> drivers/usb/gadget/composite.c | 2 +- >>>> 1 files changed, 1 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/drivers/usb/gadget/composite.c >>>> b/drivers/usb/gadget/composite.c index 09289bb..bda5cdb 100644 >>>> --- a/drivers/usb/gadget/composite.c >>>> +++ b/drivers/usb/gadget/composite.c >>>> @@ -436,7 +436,7 @@ static int set_config(struct usb_composite_dev >>>> *cdev, >>>> >>>> else >>>> >>>> descriptors = f->descriptors; >>>> >>>> - for (; *descriptors; ++descriptors) { >>>> + for (; descriptors && *descriptors; ++descriptors) { >>> >>> How comes your function has no descriptors ? >> >> good question and this is what confuses me. I do not understand this USB >> code very well, but what I see is that if I skip the for loop, which >> wasn't present in 2.6.28 my USB device is also working in 2.6.33. We added >> some small stuff in USB to be able to configure the baudrate of the serial >> emulation via IOCTL. But we did nothing different in the initialisation of >> the USB device. >> >> The output during startup is: >> fsl_qe_udc: Freescale QE/CPM USB Device Controller driver, 1.0 >> fsl_qe_udc f0011b60.usb: CPM USB controller initialized as device >> g_serial gadget: Gadget Serial v2.4 >> g_serial gadget: g_serial ready >> fsl_qe_udc f0011b60.usb: fsl_qe_udc bind to driver g_serial >> >> But if I plug in the connector my board is crashing without my patch. > > Could it be because your gadget is missing descriptors for one of the two > speeds (FS/HS) ? > yes you are right. If I look at ./drivers/usb/gadget/serial.c there is no code where these descriptors are set as e.g. in ./drivers/usb/gadget/f_serial.c So it seems that there is an error in the initialisation of the driver than in your code in composite.c. Thanks for pointing out. Regards Holger Brunck -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html