usb: chipidea: udc: don't truncate requests to single tds
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Sat, 30 Mar 2013 10:54:08 +0000 (12:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Mar 2013 15:20:48 +0000 (08:20 -0700)
It is not safe to truncate requests to the maximum possible size the
controller can handle with one td and to keep working. That patch fixes
that with proper error handling instead.

Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/udc.c

index 20a5b79f58f8b6f8ea6476dda60a27d4f7ee2c20..0531532a5c8e1e725ed5eaadba3ee180e0fb625f 100644 (file)
@@ -1158,9 +1158,9 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
        }
 
        if (req->length > 4 * CI13XXX_PAGE_SIZE) {
-               req->length = 4 * CI13XXX_PAGE_SIZE;
                retval = -EMSGSIZE;
-               dev_warn(mEp->ci->dev, "request length truncated\n");
+               dev_err(mEp->ci->dev, "request bigger than one td\n");
+               goto done;
        }
 
        /* push request */