summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJerry Lee <jerrylee@qnap.com>2017-08-06 01:18:31 -0400
committerSasha Levin <alexander.levin@verizon.com>2017-09-10 16:36:00 -0400
commit7081e537432cfdd7a8585118c970d1a0f7cac865 (patch)
treeaa58634a827f8dbc99bca4773ff058df9612b2de /fs
parentacf8a4202a71e18795f5d2130cd494418de15d3d (diff)
ext4: fix overflow caused by missing cast in ext4_resize_fs()
[ Upstream commit aec51758ce10a9c847a62a48a168f8c804c6e053 ] On a 32-bit platform, the value of n_blcoks_count may be wrong during the file system is resized to size larger than 2^32 blocks. This may caused the superblock being corrupted with zero blocks count. Fixes: 1c6bd7173d66 Signed-off-by: Jerry Lee <jerrylee@qnap.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org # 3.7+ Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/resize.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 0e783b9f7007..b63e308e2545 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1932,7 +1932,8 @@ retry:
n_desc_blocks = o_desc_blocks +
le16_to_cpu(es->s_reserved_gdt_blocks);
n_group = n_desc_blocks * EXT4_DESC_PER_BLOCK(sb);
- n_blocks_count = n_group * EXT4_BLOCKS_PER_GROUP(sb);
+ n_blocks_count = (ext4_fsblk_t)n_group *
+ EXT4_BLOCKS_PER_GROUP(sb);
n_group--; /* set to last group number */
}