USB: fix memory leak in cdc-acm
authorOliver Neukum <oliver@neukum.org>
Tue, 21 Oct 2008 08:39:04 +0000 (10:39 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 22 Oct 2008 17:05:29 +0000 (10:05 -0700)
This fixes a memory leak on disconnect in cdc-acm

Thanks to 施金前 for finding it.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/cdc-acm.c

index fab23ee8702b0a813ef4da6ba9a63dc3c7271d28..20104443081ad1fc260d4ba74f17a0c9828eca69 100644 (file)
@@ -849,9 +849,10 @@ static void acm_write_buffers_free(struct acm *acm)
 {
        int i;
        struct acm_wb *wb;
+       struct usb_device *usb_dev = interface_to_usbdev(acm->control);
 
        for (wb = &acm->wb[0], i = 0; i < ACM_NW; i++, wb++) {
-               usb_buffer_free(acm->dev, acm->writesize, wb->buf, wb->dmah);
+               usb_buffer_free(usb_dev, acm->writesize, wb->buf, wb->dmah);
        }
 }