diff mbox

[1/3] usbnet: fix leak of transfer buffer of dev->interrupt

Message ID 1335775864-4873-2-git-send-email-tom.leiming@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ming Lei April 30, 2012, 8:51 a.m. UTC
The transfer buffer of dev->interrupt is allocated in .probe path,
but not freed in .disconnet path, so mark the interrupt URB as
URB_FREE_BUFFER to free the buffer when the URB is destroyed.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/net/usb/usbnet.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Oliver Neukum April 30, 2012, 8:58 a.m. UTC | #1
Am Montag, 30. April 2012, 10:51:02 schrieb Ming Lei:
> The transfer buffer of dev->interrupt is allocated in .probe path,
> but not freed in .disconnet path, so mark the interrupt URB as
> URB_FREE_BUFFER to free the buffer when the URB is destroyed.
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.de>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller May 3, 2012, 12:13 a.m. UTC | #2
From: Oliver Neukum <oneukum@suse.de>
Date: Mon, 30 Apr 2012 10:58:14 +0200

> Am Montag, 30. April 2012, 10:51:02 schrieb Ming Lei:
>> The transfer buffer of dev->interrupt is allocated in .probe path,
>> but not freed in .disconnet path, so mark the interrupt URB as
>> URB_FREE_BUFFER to free the buffer when the URB is destroyed.
>> 
>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> Acked-by: Oliver Neukum <oneukum@suse.de>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index db99536..5b38a3a 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);