浏览代码

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>
Dan Carpenter 10 年之前
父节点
当前提交
2bb2077ee6
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      drivers/usb/gadget/function/f_printer.c

+ 1 - 0
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);