Re: add null pointer check to USB gadget driver

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

 



Hi Holger,

On Friday 24 September 2010 16:59:23 Holger brunck 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) ?

-- 
Regards,

Laurent Pinchart
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux