Skip to content

Commit 1309753

Browse files
virraajgregkh
authored andcommitted
usb: musb: Balance list entry in musb_gadget_queue
commit 21b5fcd 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: ea2f35c ("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>
1 parent 2740914 commit 1309753

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/usb/musb/musb_gadget.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,9 +1247,11 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
12471247
status = musb_queue_resume_work(musb,
12481248
musb_ep_restart_resume_work,
12491249
request);
1250-
if (status < 0)
1250+
if (status < 0) {
12511251
dev_err(musb->controller, "%s resume work: %i\n",
12521252
__func__, status);
1253+
list_del(&request->list);
1254+
}
12531255
}
12541256

12551257
unlock:

0 commit comments

Comments
 (0)