Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1589408 > unrolled thread

[PATCH] usb: gadget: configs: plug memory leak

Started byJohn Keeping <john@metanate.com>
First post2017-02-28 13:40 +0100
Last post2017-02-28 15:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb: gadget: configs: plug memory leak John Keeping <john@metanate.com> - 2017-02-28 13:40 +0100
    Re: [PATCH] usb: gadget: configs: plug memory leak Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-02-28 15:10 +0100

#1589408 — [PATCH] usb: gadget: configs: plug memory leak

FromJohn Keeping <john@metanate.com>
Date2017-02-28 13:40 +0100
Subject[PATCH] usb: gadget: configs: plug memory leak
Message-ID<tfPeq-4pW-21@gated-at.bofh.it>
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>
---
 drivers/usb/gadget/configfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 78c44979dde3..cbff3b02840d 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;
-- 
2.12.0.rc2.230.ga28edc07cd.dirty

[toc] | [next] | [standalone]


#1589488

FromSuzuki K Poulose <Suzuki.Poulose@arm.com>
Date2017-02-28 15:10 +0100
Message-ID<tfQDw-5uI-27@gated-at.bofh.it>
In reply to#1589408
On 28/02/17 10:55, John Keeping wrote:
> 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>
> ---
>  drivers/usb/gadget/configfs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
> index 78c44979dde3..cbff3b02840d 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);

Looks correct to me.

Suzuki

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web