usb: gadget: uvc: don't put item still in use
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Fri, 30 Sep 2022 12:28:39 +0000 (14:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Sep 2022 13:07:20 +0000 (15:07 +0200)
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>
drivers/usb/gadget/function/f_uvc.c

index 836601227155d02c0c69af5899c1ceb640e6feec..6e196e06181ecf21b2bf225adbadefed9e0c9f2b 100644 (file)
@@ -995,7 +995,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);