[10/29] usb: serial: fix memory leak in generic driver

From: Greg KH
Date: Fri Jan 22 2010 - 19:19:05 EST

2.6.32-stable review patch. If anyone has any objections, please let us know.


From: Johan Hovold <jhovold@xxxxxxxxx>

commit 2591530204a76fecc843529ade56afe865dd2657 upstream.

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@xxxxxxxxx>
Cc: Greg KH <greg@xxxxxxxxx>
Acked-by: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

drivers/usb/serial/generic.c | 2 ++
1 file changed, 2 insertions(+)

--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -489,6 +489,8 @@ void usb_serial_generic_write_bulk_callb
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->tx_bytes_flight -= urb->transfer_buffer_length;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/