lkml.org 
[lkml]   [2023]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2] usb: gadget: uvc_video: unlock before submitting a request to ep
Date
There could be chances where the usb_ep_queue() could fail and trigger
complete() handler with error status. In this case, if usb_ep_queue()
is called with lock held and the triggered complete() handler is waiting
for the same lock to be cleared could result in a deadlock situation and
could result in system hang, so call usb_ep_queue() without the lock to
resolve this issue.

Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
---
Changes in V2:
- Addressed Dan and Sergey review comments:
- Removed unwanted usb_ep_set_halt, it's alreadly call on error path.
- Updated commit message.

Link: https://lore.kernel.org/lkml/20231102071138.828126-1-piyush.mehta@amd.com/T/
---
drivers/usb/gadget/function/uvc_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index 91af3b1ef0d4..705d762b7f5c 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -460,10 +460,10 @@ static void uvcg_video_pump(struct work_struct *work)
req->no_interrupt = 1;
}

- /* Queue the USB request */
- ret = uvcg_video_ep_queue(video, req);
spin_unlock_irqrestore(&queue->irqlock, flags);

+ /* Queue the USB request */
+ ret = uvcg_video_ep_queue(video, req);
if (ret < 0) {
uvcg_queue_cancel(queue, 0);
break;
--
2.25.1
\
 
 \ /
  Last update: 2023-11-20 13:53    [W:0.040 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site