summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2019-11-19 12:25:42 -0500
committerTheodore Ts'o <tytso@mit.edu>2019-11-19 12:25:42 -0500
commitdfdeeb41fb08fbe11d3cfefba9c0fcd00c95a36d (patch)
tree58b5bb270d3b3574e2a0828455f6fdd7ac7eae40 /fs/ext4/inode.c
parent3c845acd0237caef617f330a0e3b37ad8ae9fea5 (diff)
parentc7df4a1ecb8579838ec8c56b2bb6a6716e974f37 (diff)
downloadblackbird-op-linux-dfdeeb41fb08fbe11d3cfefba9c0fcd00c95a36d.tar.gz
blackbird-op-linux-dfdeeb41fb08fbe11d3cfefba9c0fcd00c95a36d.zip
Merge branch 'tt/misc' into dev
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8c37626e4c01..310e4abd9aca 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5580,8 +5580,23 @@ static int __ext4_expand_extra_isize(struct inode *inode,
{
struct ext4_inode *raw_inode;
struct ext4_xattr_ibody_header *header;
+ unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb);
+ struct ext4_inode_info *ei = EXT4_I(inode);
int error;
+ /* this was checked at iget time, but double check for good measure */
+ if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
+ (ei->i_extra_isize & 3)) {
+ EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)",
+ ei->i_extra_isize,
+ EXT4_INODE_SIZE(inode->i_sb));
+ return -EFSCORRUPTED;
+ }
+ if ((new_extra_isize < ei->i_extra_isize) ||
+ (new_extra_isize < 4) ||
+ (new_extra_isize > inode_size - EXT4_GOOD_OLD_INODE_SIZE))
+ return -EINVAL; /* Should never happen */
+
raw_inode = ext4_raw_inode(iloc);
header = IHDR(inode, raw_inode);
OpenPOWER on IntegriCloud