[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPhsuW6JJLsdcv2gQY6QEhbTSRiamTtGo4GBL1uSoUx8ZsdKgw@mail.gmail.com>
Date: Thu, 20 Oct 2022 10:47:01 -0700
From: Song Liu <song@...nel.org>
To: Li Zhong <floridsleeves@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org
Subject: Re: [PATCH v1] drivers/md/md-bitmap: check the return value of md_bitmap_get_counter()
On Thu, Sep 8, 2022 at 9:09 PM Li Zhong <floridsleeves@...il.com> wrote:
>
> Check the return value of md_bitmap_get_counter() in case it returns
> NULL pointer, which will result in a null pointer dereference.
>
> Signed-off-by: Li Zhong <floridsleeves@...il.com>
Somehow I didn't get v2 of this in my inbox. So replying to v1:
Applied v2 to md-next.
Thanks,
Song
> ---
> drivers/md/md-bitmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index bf6dffadbe6f..06ab1098ff99 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -2195,7 +2195,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
>
> if (set) {
> bmc_new = md_bitmap_get_counter(&bitmap->counts, block, &new_blocks, 1);
> - if (*bmc_new == 0) {
> + if (bmc_new && *bmc_new == 0) {
> /* need to set on-disk bits too. */
> sector_t end = block + new_blocks;
> sector_t start = block >> chunkshift;
> --
> 2.25.1
>
Powered by blists - more mailing lists