diff options
Diffstat (limited to 'fs/ext3/resize.c')
-rw-r--r-- | fs/ext3/resize.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index e186f7fb698b..9e318a5cfc87 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -731,6 +731,18 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input) | |||
731 | return -EPERM; | 731 | return -EPERM; |
732 | } | 732 | } |
733 | 733 | ||
734 | if (le32_to_cpu(es->s_blocks_count) + input->blocks_count < | ||
735 | le32_to_cpu(es->s_blocks_count)) { | ||
736 | ext3_warning(sb, __FUNCTION__, "blocks_count overflow\n"); | ||
737 | return -EINVAL; | ||
738 | } | ||
739 | |||
740 | if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) < | ||
741 | le32_to_cpu(es->s_inodes_count)) { | ||
742 | ext3_warning(sb, __FUNCTION__, "inodes_count overflow\n"); | ||
743 | return -EINVAL; | ||
744 | } | ||
745 | |||
734 | if (reserved_gdb || gdb_off == 0) { | 746 | if (reserved_gdb || gdb_off == 0) { |
735 | if (!EXT3_HAS_COMPAT_FEATURE(sb, | 747 | if (!EXT3_HAS_COMPAT_FEATURE(sb, |
736 | EXT3_FEATURE_COMPAT_RESIZE_INODE)){ | 748 | EXT3_FEATURE_COMPAT_RESIZE_INODE)){ |
@@ -959,6 +971,11 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
959 | 971 | ||
960 | add = EXT3_BLOCKS_PER_GROUP(sb) - last; | 972 | add = EXT3_BLOCKS_PER_GROUP(sb) - last; |
961 | 973 | ||
974 | if (o_blocks_count + add < o_blocks_count) { | ||
975 | ext3_warning(sb, __FUNCTION__, "blocks_count overflow"); | ||
976 | return -EINVAL; | ||
977 | } | ||
978 | |||
962 | if (o_blocks_count + add > n_blocks_count) | 979 | if (o_blocks_count + add > n_blocks_count) |
963 | add = n_blocks_count - o_blocks_count; | 980 | add = n_blocks_count - o_blocks_count; |
964 | 981 | ||