ext4: include terminating u32 in size of xattr entries when expanding inodes
authorTheodore Ts'o <tytso@mit.edu>
Wed, 19 Dec 2018 17:28:13 +0000 (12:28 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2019 15:16:43 +0000 (16:16 +0100)
commit2eb64177787db8b5699dd05b9ba5c1bc2f7ece95
tree8e3e8d92a82c3a9b70a012acb8ae552a99c8c994
parentc72f56c5ae2a6760c48498ed3e1ca6b256d2062d
ext4: include terminating u32 in size of xattr entries when expanding inodes

commit a805622a757b6d7f65def4141d29317d8e37b8a1 upstream.

In ext4_expand_extra_isize_ea(), we calculate the total size of the
xattr header, plus the xattr entries so we know how much of the
beginning part of the xattrs to move when expanding the inode extra
size.  We need to include the terminating u32 at the end of the xattr
entries, or else if there is uninitialized, non-zero bytes after the
xattr entries and before the xattr values, the list of xattr entries
won't be properly terminated.

Reported-by: Steve Graham <stgraham2000@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/xattr.c