usb: gadget: f_hid: use after free in hidg_alloc_inst()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 13 Nov 2014 06:19:47 +0000 (09:19 +0300)
committerFelipe Balbi <balbi@ti.com>
Tue, 18 Nov 2014 14:47:44 +0000 (08:47 -0600)
We free "opts" on the error path and then dereference it.

Fixes: 21a9476a7ba8 ('usb: gadget: hid: add configfs support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/function/f_hid.c

index 7d18f413ffea9876274b254f95ca5984b68fcedb..f0545f801c9d0ca417db02e28d531430b8561504 100644 (file)
@@ -875,6 +875,7 @@ static struct usb_function_instance *hidg_alloc_inst(void)
                kfree(opts);
                if (idr_is_empty(&hidg_ida.idr))
                        ghid_cleanup();
+               goto unlock;
        }
        config_group_init_type_name(&opts->func_inst.group, "", &hid_func_type);