summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/f_hid.c
diff options
context:
space:
mode:
authorPavitrakumar Managutte <pavitra1729@gmail.com>2014-10-22 19:24:58 +0530
committerFelipe Balbi <balbi@ti.com>2014-10-23 13:57:24 -0500
commitd12a8727171c770990c246f0682f0af7859bb245 (patch)
tree65f081be3d25e5b85187acbfb46d7a3f2f4fd727 /drivers/usb/gadget/function/f_hid.c
parent1200a82a59b6aa65758ccc92c3447b98c53cd7a2 (diff)
downloadlinux-stable-d12a8727171c770990c246f0682f0af7859bb245.tar.gz
linux-stable-d12a8727171c770990c246f0682f0af7859bb245.tar.bz2
linux-stable-d12a8727171c770990c246f0682f0af7859bb245.zip
usb: gadget: function: Remove redundant usb_free_all_descriptors
Removed usb_free_all_descriptors in the bind functions, which results in double-free corruption of the descriptors on error path. The usb descriptors are allocated by usb_assign_descriptors. Signed-off-by: Pavitrakumar Managutte <pavitra1729@gmail.com> Reviewed-by: Robert Baldyga <r.baldyga@samsung.com> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function/f_hid.c')
-rw-r--r--drivers/usb/gadget/function/f_hid.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index a95290a1289f..59ab62c92b66 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -621,12 +621,14 @@ static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f)
dev = MKDEV(major, hidg->minor);
status = cdev_add(&hidg->cdev, dev, 1);
if (status)
- goto fail;
+ goto fail_free_descs;
device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor);
return 0;
+fail_free_descs:
+ usb_free_all_descriptors(f);
fail:
ERROR(f->config->cdev, "hidg_bind FAILED\n");
if (hidg->req != NULL) {
@@ -635,7 +637,6 @@ fail:
usb_ep_free_request(hidg->in_ep, hidg->req);
}
- usb_free_all_descriptors(f);
return status;
}