• Jan Kara's avatar
    ext2: Fix underflow in ext2_max_size() · e1ac0077
    Jan Kara authored
    commit 1c2d1421 upstream.
    
    When ext2 filesystem is created with 64k block size, ext2_max_size()
    will return value less than 0. Also, we cannot write any file in this fs
    since the sb->maxbytes is less than 0. The core of the problem is that
    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.
    
    File size limits computed with the new function for the full range of
    possible block sizes look like:
    
    bits file_size
    10     17247252480
    11    275415851008
    12   2196873666560
    13   2197948973056
    14   2198486220800
    15   2198754754560
    16   2198888906752
    
    CC: stable@vger.kernel.org
    Reported-by: 's avataryangerkun <yangerkun@huawei.com>
    Signed-off-by: 's avatarJan Kara <jack@suse.cz>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e1ac0077
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
acl.c Loading commit data...
acl.h Loading commit data...
balloc.c Loading commit data...
dir.c Loading commit data...
ext2.h Loading commit data...
file.c Loading commit data...
ialloc.c Loading commit data...
inode.c Loading commit data...
ioctl.c Loading commit data...
namei.c Loading commit data...
super.c Loading commit data...
symlink.c Loading commit data...
xattr.c Loading commit data...
xattr.h Loading commit data...
xattr_security.c Loading commit data...
xattr_trusted.c Loading commit data...
xattr_user.c Loading commit data...