mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
UPSTREAM: 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: 6acba0345b68 ("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>
Bug: 314338409
(cherry picked from commit 9866dc4314c6c858e451933f965d64532aec00a9)
Change-Id: If25fba6661d55cd972d76068750f3b445c8360aa
Signed-off-by: Avichal Rakesh <arakesh@google.com>
This commit is contained in:
committed by
Todd Kjos
parent
9267e267be
commit
427210e440
@@ -469,13 +469,15 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
|
|||||||
* Put request back in req_free for it to be cleaned
|
* Put request back in req_free for it to be cleaned
|
||||||
* up later.
|
* up later.
|
||||||
*/
|
*/
|
||||||
uvcg_queue_cancel(queue, 0);
|
|
||||||
list_add_tail(&to_queue->list, &video->req_free);
|
list_add_tail(&to_queue->list, &video->req_free);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uvc_video_free_request(ureq, ep);
|
uvc_video_free_request(ureq, ep);
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&video->req_lock, flags);
|
spin_unlock_irqrestore(&video->req_lock, flags);
|
||||||
|
if (ret < 0)
|
||||||
|
uvcg_queue_cancel(queue, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user