diff options
author | Li Jun <B47624@freescale.com> | 2014-08-28 15:44:11 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-09-02 16:16:45 +0200 |
commit | be0a8887bb931af0e21531da20c41533effbb0d6 (patch) | |
tree | ca28abb67c063045c767e0ab385043e5f803754d /drivers/usb/gadget/composite.c | |
parent | usb: phy: twl6030-usb: Remove unused irq_enabled (diff) | |
download | linux-be0a8887bb931af0e21531da20c41533effbb0d6.tar.xz linux-be0a8887bb931af0e21531da20c41533effbb0d6.zip |
usb: gadget: composite: dequeue cdev->req before free its buffer
commit f226708(usb: gadget: composite: dequeue cdev->req before free it in
composite_dev_cleanup) fixed a bug: free the usb request(i.e. cdev->req) but
does not dequeue it beforehand. This fix is not proper enough because it
dequeues the request after free its data buffer, considering the hardware can
access the buffer's memory anytime before the request's complettion rountine
runs, and usb_ep_dequeue always call the complettion rountine before it returns,
so the best way is to dequeue the request before free its buffer.
Suggested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Li Jun <b47624@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 6935a822ce2b..4514e73d9e70 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1955,8 +1955,8 @@ void composite_dev_cleanup(struct usb_composite_dev *cdev) usb_ep_free_request(cdev->gadget->ep0, cdev->os_desc_req); } if (cdev->req) { - kfree(cdev->req->buf); usb_ep_dequeue(cdev->gadget->ep0, cdev->req); + kfree(cdev->req->buf); usb_ep_free_request(cdev->gadget->ep0, cdev->req); } cdev->next_string_id = 0; |