Skip to content

Commit

Permalink
ext4: include terminating u32 in size of xattr entries when expanding…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tytso authored and gregkh committed Jan 9, 2019
1 parent c72f56c commit 2eb6417
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
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)
Expand Down

0 comments on commit 2eb6417

Please sign in to comment.