linux-stable/fs/ext2
Zhang Yi 3813591bc0 ext2: correct max file size computing
[ Upstream commit 50b3a81899 ]

We need to calculate the max file size accurately if the total blocks
that can address by block tree exceed the upper_limit. But this check is
not correct now, it only compute the total data blocks but missing
metadata blocks are needed. So in the case of "data blocks < upper_limit
&& total blocks > upper_limit", we will get wrong result. Fortunately,
this case could not happen in reality, but it's confused and better to
correct the computing.

  bits   data blocks   metadatablocks   upper_limit
  10        16843020            66051    2147483647
  11       134480396           263171    1073741823
  12      1074791436          1050627     536870911 (*)
  13      8594130956          4198403     268435455 (*)
  14     68736258060         16785411     134217727 (*)
  15    549822930956         67125251      67108863 (*)
  16   4398314962956        268468227      33554431 (*)

  [*] Need to calculate in depth.

Fixes: 1c2d14212b ("ext2: Fix underflow in ext2_max_size()")
Link: https://lore.kernel.org/r/20220212050532.179055-1-yi.zhang@huawei.com
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:35 +02:00
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
acl.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
balloc.c ext2: fix sleeping in atomic bugs on error 2021-09-22 13:05:23 +02:00
dir.c fs/ext2: Avoid page_address on pages returned by ext2_get_page 2021-07-16 12:36:51 +02:00
ext2.h \n 2021-08-30 10:24:50 -07:00
file.c ext2: Convert to using invalidate_lock 2021-07-13 14:29:00 +02:00
ialloc.c inode: make init and permission helpers idmapped mount aware 2021-01-24 14:27:16 +01:00
inode.c \n 2021-08-30 10:24:50 -07:00
ioctl.c ext2: convert to fileattr 2021-04-12 15:04:29 +02:00
Kconfig ext2: use iomap_fiemap to implement ->fiemap 2021-07-27 11:00:32 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c fs/ext2: Avoid page_address on pages returned by ext2_get_page 2021-07-16 12:36:51 +02:00
super.c ext2: correct max file size computing 2022-04-08 14:23:35 +02:00
symlink.c ext2: code cleanup by removing ifdef macro surrounding 2020-05-22 15:11:00 +02:00
xattr.c ext2: initialize quota info in ext2_xattr_set() 2020-07-09 08:14:01 +02:00
xattr.h ext2: code cleanup by removing ifdef macro surrounding 2020-05-22 15:11:00 +02:00
xattr_security.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr_trusted.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr_user.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00