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, Feb 22, 2011 at 8:49 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 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,

I didn't quite understand your last point.

This test works for g_file_storage gadget since "fsg->ep0req->length =
0" in fsg_setup() function in file_storage.c.

Does setting "req->length= 0" in composite_setup() in f_mass_storage.c
have any unwanted side effect?

Should this change be done in the f_mass_storage.c under "case
FSG_STATE_RESET" just before ep0_queue() is called (since we know that
RESET request does not have a data phase)?

If not any pointers to handle this?

Regards,
Maulik
--
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