summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-03-13 12:11:42 +0300
committerFelipe Balbi <balbi@ti.com>2015-03-13 10:41:01 -0500
commit2bb2077ee607703771c35ed74837180760f9ce07 (patch)
tree9ac6228d2899917050408ffab900912aae8e168e
parentfdb51e3d97552413c851bf8426ef69508389df88 (diff)
usb: gadget: printer: use after free in gprinter_alloc_inst()
There was a missing goto so we free "opts" and then dereference it. Fixes: ee1cd515e889 ('usb: gadget: printer: 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_printer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c
index caa56de3a3e8..48882ecf1610 100644
--- a/drivers/usb/gadget/function/f_printer.c
+++ b/drivers/usb/gadget/function/f_printer.c
@@ -1307,6 +1307,7 @@ static struct usb_function_instance *gprinter_alloc_inst(void)
kfree(opts);
if (idr_is_empty(&printer_ida.idr))
gprinter_cleanup();
+ goto unlock;
}
config_group_init_type_name(&opts->func_inst.group, "",
&printer_func_type);