usb: serial: fix memory leak in generic driver
authorJohan Hovold <jhovold@gmail.com>
Wed, 6 Jan 2010 23:48:42 +0000 (15:48 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 20 Jan 2010 23:24:33 +0000 (15:24 -0800)
Fix a regression introduced by commit
715b1dc01fe44537e8fce9566e4bb48d6821d84b ("USB: usb_debug,
usb_generic_serial: implement multi urb write").

URB transfer buffer was never freed when using multi-urb writes.
Currently the only driver enabling multi-urb writes is usb_debug.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Cc: Greg KH <greg@kroah.com>
Acked-by: Jason Wessel <jason.wessel@windriver.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/generic.c

index 5ce033ab9b99cbd16277c6e299b5bf05ad80e433..83443d6306d60e03f5b60ea0f9c4b70ae01f292b 100644 (file)
@@ -489,6 +489,8 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
        dbg("%s - port %d", __func__, port->number);
 
        if (port->serial->type->max_in_flight_urbs) {
+               kfree(urb->transfer_buffer);
+
                spin_lock_irqsave(&port->lock, flags);
                --port->urbs_in_flight;
                port->tx_bytes_flight -= urb->transfer_buffer_length;