Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29974620 authored by Jack Pham's avatar Jack Pham
Browse files

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: default avatarJack Pham <jackp@codeaurora.org>
parent da731b30
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment