summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-11-13 06:19:47 (GMT)
committerFelipe Balbi <balbi@ti.com>2014-11-18 14:47:44 (GMT)
commit828f6148e89ec051c2540400773655c0174ccaa3 (patch)
treebeb82dfe31dfc867320daabead8e6fd5f8247f80
parentefed421a94e62a7ddbc76acba4312b70e4be958f (diff)
downloadlinux-828f6148e89ec051c2540400773655c0174ccaa3.tar.xz
usb: gadget: f_hid: use after free in hidg_alloc_inst()
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>
-rw-r--r--drivers/usb/gadget/function/f_hid.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 7d18f41..f0545f8 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -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);