[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48CC1ADD.7070101@pobox.com>
Date: Sat, 13 Sep 2008 15:56:13 -0400
From: Jeff Garzik <jgarzik@...ox.com>
To: Adrian Bunk <bunk@...nel.org>
CC: gregkh@...e.de, linux-usb@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [2.6 patch] hso_create_bulk_serial_device(): fix a double free
Adrian Bunk wrote:
> hso_serial_common_free() mustn't be called if
> hso_serial_common_create() fails.
>
> Reported-by: Adrian Bunk <bunk@...nel.org>
> Signed-off-by: Adrian Bunk <bunk@...nel.org>
>
> ---
>
> drivers/net/usb/hso.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> d7557f8eda806e6888232bae1b86dfdd8b6cf330
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index 1b7cac7..8c11295 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -2206,39 +2206,40 @@ static struct hso_device *hso_create_bulk_serial_device(
> if (hso_serial_common_create(serial, num_urbs, BULK_URB_RX_SIZE,
> BULK_URB_TX_SIZE))
> goto exit;
>
> serial->in_endp = hso_get_ep(interface, USB_ENDPOINT_XFER_BULK,
> 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;
>
> /* and record this serial */
> set_serial_by_index(serial->minor, serial);
>
> /* setup the proc dirs and files if needed */
> hso_log_port(hso_dev);
>
> /* 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;
> }
>
> /* Creates a multiplexed AT channel */
> static
applied
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists