diff options
author | Lukas Czerner <lczerner@redhat.com> | 2018-06-28 15:59:09 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-06-28 17:22:06 -0400 |
commit | cabde4999d1d10b6ace32eaddc99699b91e40551 (patch) | |
tree | 9d0996cb9b1b9487b61d3af9b3e09d414bdc81a3 /e2fsck/pass1.c | |
parent | 73b69a891e5460771672cc28fbc685a329f07be4 (diff) | |
download | e2fsprogs-cabde4999d1d10b6ace32eaddc99699b91e40551.tar.gz |
e2fsck: do not allow initialized blocks pass i_size
We do not allow initialized blocks to exist past i_size as this could
lead to stale data exposure.
Remove test f_pgsize_gt_blksize because it is testing for the scenario
that not allowed. f_eofblocks is already testing for this.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass1.c')
-rw-r--r-- | e2fsck/pass1.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index f1fa5d94..461f5fb6 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -3448,16 +3448,8 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, size = EXT2_I_SIZE(inode); if ((pb.last_init_lblock >= 0) && - /* if size is smaller than expected by the block count, - * allow allocated blocks to end of PAGE_SIZE. - * last_init_lblock is the last in-use block, so it is - * the minimum expected file size, but +1 because it is - * the base-zero block number and not the block count. */ - (size < (__u64)pb.last_init_lblock * fs->blocksize) && - ((pb.last_init_lblock + 1) / blkpg * blkpg != - (pb.last_init_lblock + 1) || - size < (__u64)(pb.last_init_lblock & ~(blkpg - 1)) * - fs->blocksize)) + /* Do not allow initialized allocated blocks past i_size*/ + (size < (__u64)pb.last_init_lblock * fs->blocksize)) bad_size = 3; else if (!(extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) && size > ext2_max_sizes[fs->super->s_log_block_size]) |