patch "usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart" added to usb-testing
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will be merged to the usb-next branch sometime soon, after it passes testing, and the merge window is open.
If you have any questions about this process, please let me know.
From e9d40b215e38480fd94c66b06d79045717a59e9c Mon Sep 17 00:00:00 2001
From: Uttkarsh Aggarwal <[email protected]>
Date: Fri, 22 Dec 2023 15:17:04 +0530
Subject: usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart
Current implementation blocks the running operations when Plug-out and Plug-In is performed continuously, process gets stuck in dwc3_thread_interrupt().
Code Flow:
CPU1 ->Gadget_start ->dwc3_interrupt ->dwc3_thread_interrupt ->dwc3_process_event_buf ->dwc3_process_event_entry ->dwc3_endpoint_interrupt ->dwc3_ep0_interrupt ->dwc3_ep0_inspect_setup ->dwc3_ep0_stall_and_restart
By this time if pending_list is not empty, it will get the next request on the given list and calls dwc3_gadget_giveback which will unmap request and call its complete() callback to notify upper layers that it has completed. Currently dwc3_gadget_giveback status is set to -ECONNRESET, whereas it should be -ESHUTDOWN based on condition if not dwc->connected is true.
--- drivers/usb/dwc3/ep0.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/dwc3/ep0.c +4 -1
@@ -238,7 +238,10 @@ void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)struct dwc3_request *req; req =next_request (&dep->pending_list); -dwc3_gadget_giveback (dep, req, -ECONNRESET ); +if (!dwc->connected) +dwc3_gadget_giveback (dep, req, -ESHUTDOWN ); +else +dwc3_gadget_giveback (dep, req, -ECONNRESET ); } dwc->eps[0 ]->trb_enqueue =0 ;
Signature · 1 line
2.43.0