]> err.no Git - linux-2.6/commitdiff
USB: fix double kfree in ipaq in error case
authorOliver Neukum <oliver@neukum.org>
Mon, 30 Jun 2008 12:33:57 +0000 (14:33 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Jul 2008 22:16:47 +0000 (15:16 -0700)
in the error case the ipaq driver leaves a dangling pointer to already
freed memory that will be freed again.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ipaq.c

index d9fb3768a2d7b1ba869e4275bcc6ec9d29d1ed2c..80d9ec5570d6e37d8f09527e5be88516d5b971bc 100644 (file)
@@ -646,12 +646,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
         */
 
        kfree(port->bulk_in_buffer);
-       kfree(port->bulk_out_buffer);
        port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
        if (port->bulk_in_buffer == NULL) {
                port->bulk_out_buffer = NULL; /* prevent double free */
                goto enomem;
        }
+
+       kfree(port->bulk_out_buffer);
        port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
        if (port->bulk_out_buffer == NULL) {
                kfree(port->bulk_in_buffer);