From: Jeff Garzik <jgarzik@pobox.com>
To: Adrian Bunk <bunk@kernel.org>
Cc: gregkh@suse.de, linux-usb@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [2.6 patch] hso_create_bulk_serial_device(): fix a double free
Date: Sat, 13 Sep 2008 15:56:13 -0400 [thread overview]
Message-ID: <48CC1ADD.7070101@pobox.com> (raw)
In-Reply-To: <20080827220236.GL11734@cs181140183.pp.htv.fi>
Adrian Bunk wrote:
> 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>
>
> ---
>
> 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
prev parent reply other threads:[~2008-09-13 19:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 22:02 [2.6 patch] hso_create_bulk_serial_device(): fix a double free Adrian Bunk
2008-09-13 19:56 ` Jeff Garzik [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48CC1ADD.7070101@pobox.com \
--to=jgarzik@pobox.com \
--cc=bunk@kernel.org \
--cc=gregkh@suse.de \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).