USB: gadget: f_adb: dequeue request on error in adb_read
authorIliyan Malchev <malchev@google.com>
Fri, 18 Feb 2011 19:28:32 +0000 (11:28 -0800)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:52 +0000 (09:09 -0700)
In adb_read(), if wait_event_interruptible() returns an error, we need to
remove the request from the EP queue.  Else, on the next call to adb_read(), we
will attempt to enqueue the request again, potentially corrupting the
queue.  This is what happens with musb_gadget_queue(), which does not check for
duplicate requests.

Signed-off-by: Iliyan Malchev <malchev@google.com>
drivers/usb/gadget/f_adb.c

index 0d252766d83f985a1188985c3bf198248b49e6ef..7cfa39cda9aedef20bdda8964b65f6c7792c300a 100644 (file)
@@ -321,6 +321,7 @@ requeue_req:
        if (ret < 0) {
                dev->error = 1;
                r = ret;
+               usb_ep_dequeue(dev->ep_out, req);
                goto done;
        }
        if (!dev->error) {