Skip to content

Commit 3b9af75

Browse files
committed
ext4: move where set the MAY_INLINE_DATA flag is set
jira VULN-67318 cve-pre CVE-2023-53100 commit-author Ye Bin <yebin10@huawei.com> commit 1dcdce5 The only caller of ext4_find_inline_data_nolock() that needs setting of EXT4_STATE_MAY_INLINE_DATA flag is ext4_iget_extra_inode(). In ext4_write_inline_data_end() we just need to update inode->i_inline_off. Since we are going to add one more caller that does not need to set EXT4_STATE_MAY_INLINE_DATA, just move setting of EXT4_STATE_MAY_INLINE_DATA out to ext4_iget_extra_inode(). Signed-off-by: Ye Bin <yebin10@huawei.com> Cc: stable@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230307015253.2232062-2-yebin@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> (cherry picked from commit 1dcdce5) Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
1 parent f439d32 commit 3b9af75

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

fs/ext4/inline.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ int ext4_find_inline_data_nolock(struct inode *inode)
159159
(void *)ext4_raw_inode(&is.iloc));
160160
EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE +
161161
le32_to_cpu(is.s.here->e_value_size);
162-
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
163162
}
164163
out:
165164
brelse(is.iloc.bh);

fs/ext4/inode.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4683,8 +4683,13 @@ static inline int ext4_iget_extra_inode(struct inode *inode,
46834683

46844684
if (EXT4_INODE_HAS_XATTR_SPACE(inode) &&
46854685
*magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
4686+
int err;
4687+
46864688
ext4_set_inode_state(inode, EXT4_STATE_XATTR);
4687-
return ext4_find_inline_data_nolock(inode);
4689+
err = ext4_find_inline_data_nolock(inode);
4690+
if (!err && ext4_has_inline_data(inode))
4691+
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
4692+
return err;
46884693
} else
46894694
EXT4_I(inode)->i_inline_off = 0;
46904695
return 0;

0 commit comments

Comments
 (0)