Re: [PATCH V3] usb: gadget: composite: fix req->length in composite_setup()

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

 



On Tue, 22 Feb 2011, Michal Nazarewicz wrote:

> On Tue, 22 Feb 2011 14:38:42 +0100, Maulik Mankad <maulik@xxxxxx> wrote:
> > When USB CV MSC tests are run on f_mass_storage gadget
> > Bulk Only Mass Storage Reset fails since req->length
> > is set to USB_BUFSIZ=1024 in composite_setup().
> >
> > Initialize req->length to zero to fix this.
> 
> > diff --git a/drivers/usb/gadget/composite.c  
> > b/drivers/usb/gadget/composite.c
> > index 1ba4bef..0cafed7 100644
> > --- a/drivers/usb/gadget/composite.c
> > +++ b/drivers/usb/gadget/composite.c
> > @@ -813,7 +813,7 @@ composite_setup(struct usb_gadget *gadget, const  
> > struct usb_ctrlrequest *ctrl)
> >  	 */
> >  	req->zero = 0;
> >  	req->complete = composite_setup_complete;
> > -	req->length = USB_BUFSIZ;
> > +	req->length = 0;
> >  	gadget->ep0->driver_data = cdev;
> > 	switch (ctrl->bRequest) {
> 
> Looks good to me.
> 
> As I've said previously, I would be more confident with changing
> only f_mass_storage, but I'll trust Alan's judgement. ;)
> 
> My only concern is whether they are any composite functions which
> rely on req->length being set to the size of the provided buffer.

In principle, function drivers -- including f_mass_storage --  
shouldn't depend on req->length being set to anything.  A little 
auditing would be a good idea.

Alan Stern

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