]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: ir-usb: fix double free
authorJohan Hovold <jhovold@gmail.com>
Thu, 13 May 2010 19:02:00 +0000 (21:02 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:22:05 +0000 (11:22 -0700)
commit 2ff78c0c2b67120c8e503268da3f177cae2228a2 upstream.

If the user specifies a custom bulk buffer size we get a double free at
port release.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ir-usb.c

index 4a0f51974232cd21b8c673c23659ca5a454c92d1..71bdbe06baff32be117e414dc9d5002e2d0857f6 100644 (file)
@@ -312,6 +312,7 @@ static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
                kfree(port->read_urb->transfer_buffer);
                port->read_urb->transfer_buffer = buffer;
                port->read_urb->transfer_buffer_length = buffer_size;
+               port->bulk_in_buffer = buffer;
 
                buffer = kmalloc(buffer_size, GFP_KERNEL);
                if (!buffer) {
@@ -321,6 +322,7 @@ static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
                kfree(port->write_urb->transfer_buffer);
                port->write_urb->transfer_buffer = buffer;
                port->write_urb->transfer_buffer_length = buffer_size;
+               port->bulk_out_buffer = buffer;
                port->bulk_out_size = buffer_size;
        }