summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-12-19 20:28:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-09 19:38:43 +0300
commit6633fcb231a0864ca5c961a7664b137474ca3779 (patch)
tree730494ff02f3e8821e40c278b9b6266e5b374c59
parent11bb168baef2dc9f613e021749b6f22966ae0959 (diff)
downloadlinux-6633fcb231a0864ca5c961a7664b137474ca3779.tar.xz
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>
-rw-r--r--fs/ext4/xattr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 52856d98afd3..8ebf0967424f 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -2725,7 +2725,7 @@ retry:
base = IFIRST(header);
end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
min_offs = end - base;
- total_ino = sizeof(struct ext4_xattr_ibody_header);
+ total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32);
error = xattr_check_inode(inode, header, end);
if (error)