ext4: correct grp validation in ext4_mb_good_group
[ Upstream commit a9ce5993a0f5c0887c8a1b4ffa3b8046fbcfdc93 ] 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@huaweicloud.com> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Link: https://lore.kernel.org/r/20230801143204.2284343-2-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2aefe3ae09
commit
245759d987
@ -2103,7 +2103,7 @@ static bool ext4_mb_good_group(struct ext4_allocation_context *ac,
|
||||
|
||||
BUG_ON(cr < 0 || cr >= 4);
|
||||
|
||||
if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(grp) || !grp))
|
||||
if (unlikely(!grp || EXT4_MB_GRP_BBITMAP_CORRUPT(grp)))
|
||||
return false;
|
||||
|
||||
free = grp->bb_free;
|
||||
|
Loading…
Reference in New Issue
Block a user