[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <87a5vkw8r3.fsf@doe.com>
Date: Tue, 25 Jul 2023 16:36:24 +0530
From: Ritesh Harjani (IBM) <ritesh.list@...il.com>
To: Kemeng Shi <shikemeng@...weicloud.com>, tytso@....edu,
adilger.kernel@...ger.ca, ojaswin@...ux.ibm.com,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: shikemeng@...weicloud.com
Subject: Re: [PATCH v2 01/10] ext4: correct grp validation in ext4_mb_good_group
Kemeng Shi <shikemeng@...weicloud.com> writes:
> Group corruption check will access memory of grp and will trigger kernel
> crash if grp is NULL. So do NULL check before corruption check.
>
> Fixes: 5354b2af3406 ("ext4: allow ext4_get_group_info() to fail")
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> ---
> fs/ext4/mballoc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Looks good to me. Feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 456150ef6111..62e7a045ad79 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -2553,7 +2553,7 @@ static bool ext4_mb_good_group(struct ext4_allocation_context *ac,
>
> BUG_ON(cr < CR_POWER2_ALIGNED || cr >= EXT4_MB_NUM_CRS);
>
> - if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(grp) || !grp))
> + if (unlikely(!grp || EXT4_MB_GRP_BBITMAP_CORRUPT(grp)))
> return false;
>
> free = grp->bb_free;
> --
> 2.30.0
Powered by blists - more mailing lists