Whamcloud - gitweb
LU-11790 ldiskfs: add terminating u32 when expanding inodes
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ubuntu18 / 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 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
20 index 7fddd519adae..86ed9c686249 100644
21 --- a/fs/ext4/xattr.c
22 +++ b/fs/ext4/xattr.c
23 @@ -2722,7 +2722,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
24         base = IFIRST(header);
25         end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
26         min_offs = end - base;
27 -       total_ino = sizeof(struct ext4_xattr_ibody_header);
28 +       total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);
29  
30         error = xattr_check_inode(inode, header, end);
31         if (error)