move really old unstable patches to old-patches directory
[ext4-patch-queue.git] / properly-align-shifted-xattrs-when-expanding-inodes
blob9640e805acacd009d7c0f00f8bcdbc38e6e228e6
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
8 properly.
10 CC: stable@vger.kernel.org  # 4.4.x-
11 Signed-off-by: Jan Kara <jack@suse.cz>
12 ---
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
18 --- a/fs/ext4/xattr.c
19 +++ b/fs/ext4/xattr.c
20 @@ -1522,7 +1522,7 @@ retry:
21                 if (entry_size + EXT4_XATTR_SIZE(size) >= isize_diff)
22                         shift_bytes = isize_diff;
23                 else
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 +
29 -- 
30 2.6.6