]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix underflow in ext4_max_bitmap_size()
authorZhang Yi <yi.zhang@huawei.com>
Tue, 1 Mar 2022 11:17:04 +0000 (19:17 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 3 Mar 2022 04:56:41 +0000 (23:56 -0500)
commit1b5d7c9fe0101b3d7702a9df253fa346a97cba1c
tree59493b2132ac471877eb0a7d40128d3b03e040b7
parent10660edac8d1986c5c06d6a05f4da3729711e756
ext4: fix underflow in ext4_max_bitmap_size()

when ext4 filesystem is created with 64k block size, ^extent and
^huge_file features. the upper_limit would underflow during the
computations in ext4_max_bitmap_size(). The problem is the size of block
index tree for such large block size is more than i_blocks can carry.
So fix the computation to count with this possibility. After this fix,
the 'res' cannot overflow loff_t on the extreme case of filesystem with
huge_files and 64K block size, so this patch also revert commit
7e4f91eb46cf ("ext4: fix loff_t overflow in ext4_max_bitmap_size()").

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220301111704.2153829-1-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c