summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2017-02-28 10:55:30 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-14 09:28:18 +0100
commit59682e70c98054eb8f97e3670625992a0c85d24e (patch)
tree8d4210ee708d7cf6b9400e04044edb2306e65332 /drivers/usb
parent881b5d4841fc0d37d0d7362182d0819db927b712 (diff)
downloadlinux-stable-59682e70c98054eb8f97e3670625992a0c85d24e.tar.gz
linux-stable-59682e70c98054eb8f97e3670625992a0c85d24e.tar.bz2
linux-stable-59682e70c98054eb8f97e3670625992a0c85d24e.zip
usb: gadget: configs: plug memory leak
[ Upstream commit 38355b2a44776c25b0f2ad466e8c51bb805b3032 ] When binding a gadget to a device, "name" is stored in gi->udc_name, but this does not happen when unregistering and the string is leaked. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/configfs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 502a096fc380..a5ca409dc97e 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -269,6 +269,7 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
ret = unregister_gadget(gi);
if (ret)
goto err;
+ kfree(name);
} else {
if (gi->composite.gadget_driver.udc_name) {
ret = -EBUSY;