usb: gadget: Move req->length check from function drivers to composite

req->legth is set as 0 before calling individual function driver's
setup routines. Hence, check for the buffer length in composite_setup
only.
Also, change max buffer size to 4k to accomodate our descriptors.

Change-Id: Ic96408210e7e5576928a7147d2d8a57fa620d287
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index dc06da6..4c33695 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -37,7 +37,7 @@
  */
 
 /* big enough to hold our biggest descriptor */
-#define USB_BUFSIZ	1024
+#define USB_BUFSIZ	4096
 
 static struct usb_composite_driver *composite;
 static int (*composite_gadget_bind)(struct usb_composite_dev *cdev);
@@ -859,6 +859,10 @@
 	struct usb_function		*f = NULL;
 	u8				endp;
 
+
+	if (w_length > USB_BUFSIZ)
+		return value;
+
 	/* partial re-init of the response message; the function or the
 	 * gadget might need to intercept e.g. a control-OUT completion
 	 * when we delegate to it.