UPSTREAM: usb: gadget: uvc: don't put item still in use

With the patch "588b9e85609b (usb: gadget: uvc: add v4l2 enumeration api
calls)" the driver is keeping a list of configfs entries currently
configured. The list is used in uvc_v4l2 on runtime.

The driver now is giving back the list item just after it was referenced
with config_item_put. It also calls config_item_put on uvc_free, which
is the only and right place to give back the reference. This patch fixes
the issue by removing the extra config_item_put in uvc_alloc.

Fixes: 588b9e85609b (usb: gadget: uvc: add v4l2 enumeration api calls)
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220930122839.1747279-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 3180d827c807d8d6e5d6ba4f2e08eed9efa083af)
Bug: 259171206
Change-Id: Idf19d732cc5b90f09311a94d5d07c6e1805043f5
Signed-off-by: Avichal Rakesh <arakesh@google.com>
(cherry picked from commit ed87044a7876666e144840fc8eb7276e70e82342)
This commit is contained in:
Michael Grzeschik
2022-09-30 14:28:39 +02:00
committed by Avichal Rakesh
parent 3a8ccd0f49
commit 227271c1b6

View File

@@ -996,7 +996,6 @@ static struct usb_function *uvc_alloc(struct usb_function_instance *fi)
goto err_config;
uvc->header = to_uvcg_streaming_header(h);
config_item_put(h);
if (!uvc->header->linked) {
mutex_unlock(&opts->lock);
kfree(uvc);