mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 19:49:33 -04:00
usb: gadget: f_hid: use after free in hidg_alloc_inst()
We free "opts" on the error path and then dereference it.
Fixes: 21a9476a7b ('usb: gadget: hid: add configfs support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
committed by
Felipe Balbi
parent
efed421a94
commit
828f6148e8
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user