diff options
| author | Viraj Shah <viraj.shah@linutronix.de> | 2021-10-21 11:36:44 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-11-12 14:43:02 +0100 |
| commit | 5c3eba29047918e5174f309ca2051ff6b585f9cf (patch) | |
| tree | 76428e7759817d6d88ef2898143c0fdfae2b96fa | |
| parent | 161571745de126d2dc6685aee3d6d83fbe7928bb (diff) | |
| download | linux-5c3eba29047918e5174f309ca2051ff6b585f9cf.tar.gz linux-5c3eba29047918e5174f309ca2051ff6b585f9cf.tar.bz2 linux-5c3eba29047918e5174f309ca2051ff6b585f9cf.zip | |
usb: musb: Balance list entry in musb_gadget_queue
commit 21b5fcdccb32ff09b6b63d4a83c037150665a83f upstream.
musb_gadget_queue() adds the passed request to musb_ep::req_list. If the
endpoint is idle and it is the first request then it invokes
musb_queue_resume_work(). If the function returns an error then the
error is passed to the caller without any clean-up and the request
remains enqueued on the list. If the caller enqueues the request again
then the list corrupts.
Remove the request from the list on error.
Fixes: ea2f35c01d5ea ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Viraj Shah <viraj.shah@linutronix.de>
Link: https://lore.kernel.org/r/20211021093644.4734-1-viraj.shah@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/usb/musb/musb_gadget.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index ffe462a657b1..4622400ba4dd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1248,9 +1248,11 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, status = musb_queue_resume_work(musb, musb_ep_restart_resume_work, request); - if (status < 0) + if (status < 0) { dev_err(musb->controller, "%s resume work: %i\n", __func__, status); + list_del(&request->list); + } } unlock: |
