usb: gadget: uvc: cleanup request when not in correct state
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Mon, 11 Sep 2023 14:05:29 +0000 (16:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Oct 2023 11:58:35 +0000 (13:58 +0200)
commit52a39f2cf62bb5430ad1f54cd522dbfdab1d71ba
tree80afa34e401c8a55f1fe5456d6984a92253bbd04
parent3a63f86c6a6cb0601f0563a81574745da2979e3b
usb: gadget: uvc: cleanup request when not in correct state

The uvc_video_enable function of the uvc-gadget driver is dequeing and
immediately deallocs all requests on its disable codepath. This is not
save since the dequeue function is async and does not ensure that the
requests are left unlinked in the controller driver.

By adding the ep_free_request into the completion path of the requests
we ensure that the request will be properly deallocated.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20230911140530.2995138-3-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/uvc_video.c