1 ext4: properly align shifted xattrs when expanding inodes
3 From: Jan Kara <jack@suse.cz>
5 We did not count with the padding of xattr value when computing desired
6 shift of xattrs in the inode when expanding i_extra_isize. As a result
7 we could create unaligned start of inline xattrs. Account for alignment
10 CC: stable@vger.kernel.org # 4.4.x-
11 Signed-off-by: Jan Kara <jack@suse.cz>
13 fs/ext4/xattr.c | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
16 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
17 index b18b1ff7cc27..c893f00b6dc0 100644
20 @@ -1522,7 +1522,7 @@ retry:
21 if (entry_size + EXT4_XATTR_SIZE(size) >= isize_diff)
22 shift_bytes = isize_diff;
24 - shift_bytes = entry_size + size;
25 + shift_bytes = entry_size + EXT4_XATTR_SIZE(size);
26 /* Adjust the offsets and shift the remaining entries ahead */
27 ext4_xattr_shift_entries(entry, -shift_bytes,
28 (void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +