Skip to content

Commit

Permalink
ext4: correct max_inline_xattr_value_size computing
Browse files Browse the repository at this point in the history
[ Upstream commit c9fd167 ]

If the ext4 inode does not have xattr space, 0 is returned in the
get_max_inline_xattr_value_size function. Otherwise, the function returns
a negative value when the inode does not contain EXT4_STATE_XATTR.

Cc: [email protected]
Signed-off-by: Baokun Li <[email protected]>
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
LiBaokun96 authored and gregkh committed Aug 17, 2022
1 parent 21f6bd5 commit 7dbba79
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/ext4/inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ static int get_max_inline_xattr_value_size(struct inode *inode,
struct ext4_inode *raw_inode;
int free, min_offs;

if (!EXT4_INODE_HAS_XATTR_SPACE(inode))
return 0;

min_offs = EXT4_SB(inode->i_sb)->s_inode_size -
EXT4_GOOD_OLD_INODE_SIZE -
EXT4_I(inode)->i_extra_isize -
Expand Down

0 comments on commit 7dbba79

Please sign in to comment.