[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 2 Feb 2024 11:33:34 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+a426cde6dee8c2884b0b@...kaller.appspotmail.com>
CC: <almaz.alexandrovich@...agon-software.com>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<ntfs3@...ts.linux.dev>, <syzkaller-bugs@...glegroups.com>
Subject: [PATCH] fs/ntfs3: fix oob in mi_enum_attr
When the value of attr->size is too large, it can cause overflow when taking
the next attr. Here, off is used to determine the offset first to avoid problems.
Reported-and-tested-by: syzbot+a426cde6dee8c2884b0b@...kaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@...driver.com>
---
fs/ntfs3/record.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index 53629b1f65e9..a435df98c2b1 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -243,14 +243,14 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
off += asize;
}
- asize = le32_to_cpu(attr->size);
-
/* Can we use the first field (attr->type). */
if (off + 8 > used) {
static_assert(ALIGN(sizeof(enum ATTR_TYPE), 8) == 8);
return NULL;
}
+ asize = le32_to_cpu(attr->size);
+
if (attr->type == ATTR_END) {
/* End of enumeration. */
return NULL;
--
2.43.0
Powered by blists - more mailing lists