All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: Guoqing Jiang <gqjiang@suse.com>
Cc: linux-raid@vger.kernel.org, neilb@suse.com
Subject: Re: [PATCH] md/bitmap: call bitmap_destroy in case bitmap_create failed
Date: Fri, 25 Mar 2016 15:02:10 -0700	[thread overview]
Message-ID: <20160325220210.GA78806@kernel.org> (raw)
In-Reply-To: <1458903614-21498-1-git-send-email-gqjiang@suse.com>

On Fri, Mar 25, 2016 at 07:00:14PM +0800, Guoqing Jiang wrote:
> If bitmap_create returns an error, bitmap_destroy must be
> called to do clean up.
> 
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
>  drivers/md/bitmap.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
> index 7df6b4f..ba908e7 100644
> --- a/drivers/md/bitmap.c
> +++ b/drivers/md/bitmap.c
> @@ -1865,8 +1865,10 @@ int bitmap_copy_from_slot(struct mddev *mddev, int slot,
>  	struct bitmap_counts *counts;
>  	struct bitmap *bitmap = bitmap_create(mddev, slot);
>  
> -	if (IS_ERR(bitmap))
> +	if (IS_ERR(bitmap)) {
> +		bitmap_destroy(mddev);
>  		return PTR_ERR(bitmap);
> +	}

bitmap_create doesn't set mddev->bitmap, so bitmap_destroy will do nothing.
is this because of reference leak of sysfs_can_clear? can we move
sysfs_put(bitmap->sysfs_can_clear); to bitmap_free?

Thanks,
Shaohua

  reply	other threads:[~2016-03-25 22:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25 11:00 [PATCH] md/bitmap: call bitmap_destroy in case bitmap_create failed Guoqing Jiang
2016-03-25 22:02 ` Shaohua Li [this message]
2016-03-28  3:27   ` Guoqing Jiang
2016-03-28 18:15     ` Shaohua Li
2016-04-01  9:08 ` [V2 PATCH] md/bitmap: clear bitmap if " Guoqing Jiang
2016-04-01 20:04   ` Shaohua Li

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=20160325220210.GA78806@kernel.org \
    --to=shli@kernel.org \
    --cc=gqjiang@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.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.