]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[netdrvr/usb] hso_create_bulk_serial_device(): fix a double free
authorAdrian Bunk <bunk@kernel.org>
Wed, 27 Aug 2008 22:02:37 +0000 (01:02 +0300)
committerJeff Garzik <jgarzik@redhat.com>
Wed, 24 Sep 2008 22:49:03 +0000 (18:49 -0400)
hso_serial_common_free() mustn't be called if
hso_serial_common_create() fails.

Reported-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/usb/hso.c

index 6e42b5a8c22bb540ba9827f72ee482893c1972d4..8b2b947b6757de9249d7203b542e255d500371d1 100644 (file)
@@ -2211,14 +2211,14 @@ static struct hso_device *hso_create_bulk_serial_device(
                                     USB_DIR_IN);
        if (!serial->in_endp) {
                dev_err(&interface->dev, "Failed to find BULK IN ep\n");
-               goto exit;
+               goto exit2;
        }
 
        if (!
            (serial->out_endp =
             hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) {
                dev_err(&interface->dev, "Failed to find BULK IN ep\n");
-               goto exit;
+               goto exit2;
        }
 
        serial->write_data = hso_std_serial_write_data;
@@ -2231,9 +2231,10 @@ static struct hso_device *hso_create_bulk_serial_device(
 
        /* done, return it */
        return hso_dev;
+
+exit2:
+       hso_serial_common_free(serial);
 exit:
-       if (hso_dev && serial)
-               hso_serial_common_free(serial);
        kfree(serial);
        hso_free_device(hso_dev);
        return NULL;