Skip to contentSkip to conversation

usb: misc: legousbtower: Fix memory leak

PATCH Superseded Maksim Salau 2 participants 2 messages May 4, 2017 – May 5, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: misc: legousbtower: Fix memory leak

get_version_reply is not freed if function returns with success. Memory leak was introduced by commit 942a48730faf149ccbf3e12ac718aee120bb3529

---
 drivers/usb/misc/legousbtower.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/misc/legousbtower.c +1 -0
index aa3c280..0782ac6 100644
@@ -926,6 +926,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
 		 USB_MAJOR, dev->minor);
 
 exit:
+	kfree(get_version_reply);
 	return retval;
 
 error:
Signature · 1 line
2.9.3
#1 lore raw

Hi,

Quoted 2 lines · Maksim Salau

get_version_reply is not freed if function returns with success. Memory leak was introduced by commit 942a48730faf149ccbf3e12ac718aee120bb3529

Pointing the commit like that is probable fine, but you should also use "Fixes" tag:

Fixes 942a48730faf ("usb: misc: legousbtower: Fix buffers on stack")

Please check Documentation/process/submitting-patches.rst for more information.

Quoted 1 line

You are signing the patch for me which you should not be doing in this case. More appropriate tag would be for example "Suggested-by" or something like that. There is more information about this too in Documentation/process/submitting-patches.rst

Quoted 19 lines
---
 drivers/usb/misc/legousbtower.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/misc/legousbtower.c +1 -0
index aa3c280..0782ac6 100644
@@ -926,6 +926,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
 		 USB_MAJOR, dev->minor);
 
 exit:
+	kfree(get_version_reply);
 	return retval;
 
 error:
Signature · 1 line
2.9.3

Thanks,

Signature · 1 line
heikki