Skip to content

Commit

Permalink
usb: gadget: f_hid: use after free in hidg_alloc_inst()
Browse files Browse the repository at this point in the history
We free "opts" on the error path and then dereference it.

Fixes: 21a9476 ('usb: gadget: hid: add configfs support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Dan Carpenter authored and Felipe Balbi committed Nov 18, 2014
1 parent efed421 commit 828f614
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/function/f_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 828f614

Please sign in to comment.