summaryrefslogtreecommitdiff
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-01-09 12:01:35 +0800
committerAlex Shi <alex.shi@linaro.org>2017-01-09 12:01:35 +0800
commit19192a140ad72b5bd0d57620bfe236bc03561bb6 (patch)
treedc8289d075edcb1c23add72c425494a1e05e6f86 /fs/ext4/inode.c
parent282b308ad3b60ef0a55ff8b1ef6f16dadcede935 (diff)
parenteaa88578f2135fa8548d5f127259904a1b3f44c0 (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a4149cc2c6c0..c33fcb4f8533 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4202,6 +4202,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
struct inode *inode;
journal_t *journal = EXT4_SB(sb)->s_journal;
long ret;
+ loff_t size;
int block;
uid_t i_uid;
gid_t i_gid;
@@ -4293,6 +4294,11 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
ei->i_file_acl |=
((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
inode->i_size = ext4_isize(raw_inode);
+ if ((size = i_size_read(inode)) < 0) {
+ EXT4_ERROR_INODE(inode, "bad i_size value: %lld", size);
+ ret = -EFSCORRUPTED;
+ goto bad_inode;
+ }
ei->i_disksize = inode->i_size;
#ifdef CONFIG_QUOTA
ei->i_reserved_quota = 0;