Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.

Commit 443a8c4

Browse files
jankaratytso
authored andcommitted
ext4: properly align shifted xattrs when expanding inodes
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. CC: [email protected] # 4.4.x- Signed-off-by: Jan Kara <[email protected]>
1 parent 418c12d commit 443a8c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext4/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
15221522
if (entry_size + EXT4_XATTR_SIZE(size) >= isize_diff)
15231523
shift_bytes = isize_diff;
15241524
else
1525-
shift_bytes = entry_size + size;
1525+
shift_bytes = entry_size + EXT4_XATTR_SIZE(size);
15261526
/* Adjust the offsets and shift the remaining entries ahead */
15271527
ext4_xattr_shift_entries(entry, -shift_bytes,
15281528
(void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +

0 commit comments

Comments
 (0)