usb: gadget: audio: Free requests only after callback
As per the kernel doc for usb_ep_dequeue(), it states that "this
routine is asynchronous, that is, it may return before the completion
routine runs". And indeed the dwc3 gadget driver recently updated its
behavior to place dequeued requests on to a cancelled list to be
given back later after the endpoint is stopped.
The free_ep() was incorrectly assuming that a request was ready to
be freed after calling dequeue which results in a use-after-free
in dwc3 when it traverses its cancelled list. Fix this by moving
the usb_ep_free_request() call to the callback itself in case the
ep is disabled.
Change-Id: I51751e002ad86b226d9f0d872c66a77e94e8cab7
Signed-off-by:
Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment