[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTintuq7z45e-Cr8Ma5_Bm+UtnO+Gsysn6A3kv+CZ@mail.gmail.com>
Date: Mon, 21 Mar 2011 16:49:50 -0500
From: DMITRIY GRUZMAN <xmb836@...orola.com>
To: netdev@...r.kernel.org
Cc: Fulei TIAN <a20612@...orola.com>,
Chang Junxiao <jxchang@...orola.com>
Subject: [PATCH] usbnet: fix memory leak in usbnet_disconnect()
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@...orola.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists