summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-08-11 12:00:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-15 08:20:26 +0200
commitd4039c808f2643f403fa21d62ed530ca6c2aafae (patch)
treeec89df75ffd0e930f3c68feb74759a71741206ac /fs
parentee0775439b230d331fd419c24234dc33978a3418 (diff)
ext4: properly align shifted xattrs when expanding inodes
commit 443a8c41cd49de66a3fda45b32b9860ea0292b84 upstream. We did not count with the padding of xattr value when computing desired shift of xattrs in the inode when expanding i_extra_isize. As a result we could create unaligned start of inline xattrs. Account for alignment properly. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/xattr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 2637e9b3b6ff..2296558da891 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1521,7 +1521,7 @@ retry:
if (entry_size + EXT4_XATTR_SIZE(size) >= isize_diff)
shift_bytes = isize_diff;
else
- shift_bytes = entry_size + size;
+ shift_bytes = entry_size + EXT4_XATTR_SIZE(size);
/* Adjust the offsets and shift the remaining entries ahead */
ext4_xattr_shift_entries(entry, -shift_bytes,
(void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +