From: Konstantin Komarov almaz.alexandrovich@paragon-software.com
mainline inclusion from mainline-v6.8-rc4 commit 652cfeb43d6b9aba5c7c4902bed7a7340df131fb category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9Q8M4 CVE: CVE-2024-27407
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
---------------------------
Reported-by: Robert Morris rtm@csail.mit.edu Signed-off-by: Konstantin Komarov almaz.alexandrovich@paragon-software.com Conflicts: fs/ntfs3/record.c [Resolve conflicts due to several refactor patches not merged] Signed-off-by: Zheng Yejian zhengyejian1@huawei.com --- fs/ntfs3/record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index b06af26c00a0..31ff5d3e23c1 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -257,7 +257,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr) return NULL;
t32 = le32_to_cpu(attr->res.data_size); - if (t16 + t32 > asize) + if (t32 > asize - t16) return NULL;
if (attr->name_len &&