[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6ui=wBrToYkqEOpLyLYhjHMoy0mL0UMcXnq0ObKLLhoA@mail.gmail.com>
Date: Tue, 16 Nov 2021 23:06:21 -0800
From: Song Liu <song@...nel.org>
To: bernard@...o.com
Cc: linux-raid <linux-raid@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers/md: fix potential memleak
On Sun, Nov 14, 2021 at 7:18 PM Bernard Zhao <bernard@...o.com> wrote:
>
> In function get_bitmap_from_slot, when md_bitmap_create failed,
> md_bitmap_destroy must be called to do clean up.
Could you please explain which variable(s) need clean up?
Thanks,
Song
>
> Signed-off-by: Bernard Zhao <bernard@...o.com>
> ---
> drivers/md/md-bitmap.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index bfd6026d7809..a227bd0b9301 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -1961,6 +1961,7 @@ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
> bitmap = md_bitmap_create(mddev, slot);
> if (IS_ERR(bitmap)) {
> rv = PTR_ERR(bitmap);
> + md_bitmap_destroy(mddev)
> return ERR_PTR(rv);
> }
>
> --
> 2.33.1
>
Powered by blists - more mailing lists