kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2 -next] usb: gadget: f_hid: use after free in hidg_alloc_inst()
@ 2014-11-13  6:19 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-11-13  6:19 UTC (permalink / raw)
  To: kernel-janitors

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>

diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 56ca3fc..220035f 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);
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-13  6:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13  6:19 [patch 1/2 -next] usb: gadget: f_hid: use after free in hidg_alloc_inst() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).