Whamcloud - gitweb
LU-11790 ldiskfs: add terminating u32 when expanding inodes
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-include-terminating-u32-in-size-of-xattr-entries-when-expanding-inodes.patch
1 Date: Fri, 14 Dec 2018 22:43:43 -0500
2 From: "Theodore Ts'o" <tytso@mit.edu>
3 List-Id: <linux-ext4.vger.kernel.org>
4
5 In ext4_expand_extra_isize_ea(), we calculate the total size of the
6 xattr header, plus the xattr entries so we know how much of the
7 beginning part of the xattrs to move when expanding the inode extra
8 size.  We need to include the terminating u32 at the end of the xattr
9 entries, or else if there is uninitialized, non-zero bytes after the
10 xattr entries and before the xattr values, the list of xattr entries
11 won't be properly terminated.
12
13 Reported-by: Steve Graham <stgraham2000@gmail.com>
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 ---
16  fs/ext4/xattr.c | 2 +-
17  1 file changed, 1 insertion(+), 1 deletion(-)
18
19 Index: linux-3.10.0-862.14.4.el7/fs/ext4/xattr.c
20 ===================================================================
21 --- linux-3.10.0-862.14.4.el7.orig/fs/ext4/xattr.c
22 +++ linux-3.10.0-862.14.4.el7/fs/ext4/xattr.c
23 @@ -1628,7 +1628,7 @@ retry:
24         end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
25         min_offs = end - base;
26         last = entry;
27 -       total_ino = sizeof(struct ext4_xattr_ibody_header);
28 +       total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);
29  
30         ifree = ext4_xattr_free_space(last, &min_offs, base, &total_ino);
31         if (ifree >= isize_diff)