]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ext4: correct the misjudgment in ext4_iget_extra_inode
authorBaokun Li <libaokun1@huawei.com>
Thu, 16 Jun 2022 02:13:58 +0000 (10:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:13 +0000 (11:18 +0200)
commit 78ad009806151528f7dfdc5a88c3ba8920342cb1 upstream.

Use the EXT4_INODE_HAS_XATTR_SPACE macro to more accurately
determine whether the inode have xattr space.

Cc: stable@kernel.org
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220616021358.2504451-5-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c

index dbb25c33d07a0bf2c14a2feb63850d6eb5f1ba7c..22feae1d5f777c62881f1eb3574409100135cc3c 100644 (file)
@@ -4841,8 +4841,7 @@ static inline int ext4_iget_extra_inode(struct inode *inode,
        __le32 *magic = (void *)raw_inode +
                        EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
 
-       if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize + sizeof(__le32) <=
-           EXT4_INODE_SIZE(inode->i_sb) &&
+       if (EXT4_INODE_HAS_XATTR_SPACE(inode)  &&
            *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
                ext4_set_inode_state(inode, EXT4_STATE_XATTR);
                return ext4_find_inline_data_nolock(inode);