]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ext2: Fix underflow in ext2_max_size()
authorJan Kara <jack@suse.cz>
Tue, 29 Jan 2019 16:17:24 +0000 (17:17 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit7cb7f097ed7e88f88cb51f1e6fab7626f714921b
treeb46c1d049e4e97fddcc3fec235e47acc3299827c
parent2e5b00459bece441dfa23798fa7223b9f96e90b2
ext2: Fix underflow in ext2_max_size()

BugLink: https://bugs.launchpad.net/bugs/1837952
commit 1c2d14212b15a60300a2d4f6364753e87394c521 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: yangerkun <yangerkun@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/ext2/super.c