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

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