Skip to content

Commit 3f8a641

Browse files
committed
ext4: add check for inodes_count overflow in new resize ioctl
Addresses-Red-Hat-Bugzilla: #913245 Reported-by: Eric Sandeen <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Cc: [email protected]
1 parent 7f3e3c7 commit 3f8a641

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/ext4/resize.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,10 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
18821882
return 0;
18831883

18841884
n_group = ext4_get_group_number(sb, n_blocks_count - 1);
1885+
if (n_group > (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) {
1886+
ext4_warning(sb, "resize would cause inodes_count overflow");
1887+
return -EINVAL;
1888+
}
18851889
ext4_get_group_no_and_offset(sb, o_blocks_count - 1, &o_group, &offset);
18861890

18871891
n_desc_blocks = num_desc_blocks(sb, n_group + 1);

0 commit comments

Comments
 (0)