Skip to content

Commit 9866dc4

Browse files
Avichal Rakeshgregkh
authored andcommitted
usb: gadget: uvc: Remove nested locking
When handling error status from uvcg_video_usb_req_queue, uvc_video_complete currently calls uvcg_queue_cancel with video->req_lock held. uvcg_queue_cancel internally locks queue->irqlock, which nests queue->irqlock inside video->req_lock. This isn't a functional bug at the moment, but does open up possibilities for ABBA deadlocks in the future. This patch fixes the accidental nesting by dropping video->req_lock before calling uvcg_queue_cancel. Fixes: 6acba03 ("usb:gadget:uvc Do not use worker thread to pump isoc usb requests") Signed-off-by: Avichal Rakesh <arakesh@google.com> Link: https://lore.kernel.org/r/20240104215009.2252452-2-arakesh@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fe814b5 commit 9866dc4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/usb/gadget/function/uvc_video.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,15 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
469469
* Put request back in req_free for it to be cleaned
470470
* up later.
471471
*/
472-
uvcg_queue_cancel(queue, 0);
473472
list_add_tail(&to_queue->list, &video->req_free);
474473
}
475474
} else {
476475
uvc_video_free_request(ureq, ep);
476+
ret = 0;
477477
}
478478
spin_unlock_irqrestore(&video->req_lock, flags);
479+
if (ret < 0)
480+
uvcg_queue_cancel(queue, 0);
479481
}
480482

481483
static int

0 commit comments

Comments
 (0)