usbnet: fix leak of transfer buffer of dev->interrupt
authortom.leiming@gmail.com <tom.leiming@gmail.com>
Sun, 29 Apr 2012 22:51:02 +0000 (22:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 May 2012 00:13:03 +0000 (20:13 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/usbnet.c

index b7b3f5b0d40654c3c50b18ae56c969c03382c71c..ca6fd80c2b40ed79f1ace340b4cc0c274660a356 100644 (file)
@@ -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);