All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 2/4] rbd: fix image id leak in initial probe
Date: Mon, 29 Apr 2013 08:27:14 -0700	[thread overview]
Message-ID: <517E9152.6090209@inktank.com> (raw)
In-Reply-To: <517A94B4.4080804@inktank.com>

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 04/26/2013 07:52 AM, Alex Elder wrote:
> If a format 2 image id is found for an image being mapped, but the
> subsequent probe of the image fails, rbd_dev_probe() quits without
> freeing the image id.  Fix that.
>
> Also drop a redundant hunk of code in rbd_dev_image_id().
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 0774ae1..e79dfe2 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4794,17 +4794,21 @@ static int rbd_dev_probe(struct rbd_device *rbd_dev)
>   		ret = rbd_dev_v2_probe(rbd_dev);
>   	else
>   		ret = rbd_dev_v1_probe(rbd_dev);
> -	if (ret) {
> -		dout("probe failed, returning %d\n", ret);
> -
> -		return ret;
> -	}
> +	if (ret)
> +		goto out_err;
>
>   	ret = rbd_dev_probe_finish(rbd_dev);
>   	if (ret)
>   		rbd_header_free(&rbd_dev->header);
>
>   	return ret;
> +out_err:
> +	kfree(rbd_dev->spec->image_id);
> +	rbd_dev->spec->image_id = NULL;
> +
> +	dout("probe failed, returning %d\n", ret);
> +
> +	return ret;
>   }
>
>   static ssize_t rbd_add(struct bus_type *bus,
>


  reply	other threads:[~2013-04-29 15:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 14:51 [PATCH 0/4] rbd: cleanup and leaks #2 Alex Elder
2013-04-26 14:52 ` [PATCH 1/4] rbd: have rbd_dev_image_id() set format 1 image id Alex Elder
2013-04-29 15:26   ` Josh Durgin
2013-04-26 14:52 ` [PATCH 2/4] rbd: fix image id leak in initial probe Alex Elder
2013-04-29 15:27   ` Josh Durgin [this message]
2013-04-26 14:52 ` [PATCH 3/4] rbd: have snap_by_name() return a snapshot Alex Elder
2013-04-29 15:28   ` Josh Durgin
2013-04-26 14:53 ` [PATCH 4/4] rbd: set snapshot id in rbd_dev_probe_update_spec() Alex Elder
2013-04-29 15:31   ` Josh Durgin

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=517E9152.6090209@inktank.com \
    --to=josh.durgin@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=elder@inktank.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.