netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbnet: fix memory leak in usbnet_disconnect()
@ 2011-03-21 21:49 DMITRIY GRUZMAN
  2011-03-28  1:11 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: DMITRIY GRUZMAN @ 2011-03-21 21:49 UTC (permalink / raw)
  To: netdev; +Cc: Fulei TIAN, Chang Junxiao

usb_probe() allocates memory for transfer buffer and urb and this
memory was not properly released in usbnet_disconnect().   The issue
was found and the fix was recommended by Fu-Lei Tian and Jun-Xiao
Chang.

Signed-off-by: Dmitriy Gruzman <xmb836@motorola.com>
---
 drivers/net/usb/usbnet.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index c04d49e..67a5728 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct
usb_interface *intf)
 		} else {
 			usb_fill_int_urb(dev->interrupt, dev->udev, pipe,
 				buf, maxp, intr_complete, dev, period);
+			dev->interrupt->transfer_flags |= URB_FREE_BUFFER;
 			dev_dbg(&intf->dev,
 				"status ep%din, %d bytes period %d\n",
 				usb_pipeendpoint(pipe), maxp, period);
@@ -1237,6 +1238,7 @@ void usbnet_disconnect (struct usb_interface *intf)
 	if (dev->driver_info->unbind)
 		dev->driver_info->unbind (dev, intf);

+	usb_free_urb(dev->interrupt);
 	free_netdev(net);
 	usb_put_dev (xdev);
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usbnet: fix memory leak in usbnet_disconnect()
  2011-03-21 21:49 [PATCH] usbnet: fix memory leak in usbnet_disconnect() DMITRIY GRUZMAN
@ 2011-03-28  1:11 ` David Miller
  2011-03-28 20:01   ` Nicolas de Pesloüan
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-03-28  1:11 UTC (permalink / raw)
  To: xmb836; +Cc: netdev, a20612, jxchang

From: DMITRIY GRUZMAN <xmb836@motorola.com>
Date: Mon, 21 Mar 2011 16:49:50 -0500

> usb_probe() allocates memory for transfer buffer and urb and this
> memory was not properly released in usbnet_disconnect().   The issue
> was found and the fix was recommended by Fu-Lei Tian and Jun-Xiao
> Chang.
> 
> Signed-off-by: Dmitriy Gruzman <xmb836@motorola.com>

Your email client corrupted your patch, among other things:

> @@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct
> usb_interface *intf)

it chopped up long lines.

Please fix this up, test your setup by emailing the patch to yourself
and trying to apply what you receive, then try submitting it here
freshly again.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usbnet: fix memory leak in usbnet_disconnect()
  2011-03-28  1:11 ` David Miller
@ 2011-03-28 20:01   ` Nicolas de Pesloüan
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas de Pesloüan @ 2011-03-28 20:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Le 28/03/2011 03:11, David Miller a écrit :
> From: DMITRIY GRUZMAN<xmb836@motorola.com>
> Date: Mon, 21 Mar 2011 16:49:50 -0500
>
>> usb_probe() allocates memory for transfer buffer and urb and this
>> memory was not properly released in usbnet_disconnect().   The issue
>> was found and the fix was recommended by Fu-Lei Tian and Jun-Xiao
>> Chang.
>>
>> Signed-off-by: Dmitriy Gruzman<xmb836@motorola.com>
>
> Your email client corrupted your patch, among other things:
>
>> @@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct
>> usb_interface *intf)
>
> it chopped up long lines.
>
> Please fix this up, test your setup by emailing the patch to yourself
> and trying to apply what you receive, then try submitting it here
> freshly again.
>
> Thanks.

This nice advice should be inserted into Documentation/SubmittingPatch.

	Nicolas.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-28 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-21 21:49 [PATCH] usbnet: fix memory leak in usbnet_disconnect() DMITRIY GRUZMAN
2011-03-28  1:11 ` David Miller
2011-03-28 20:01   ` Nicolas de Pesloüan

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).