[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_7423BEE445F76E7764C6C2336F8364696C05@qq.com>
Date: Tue, 12 Nov 2024 16:35:01 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+96d5d14c47d97015c624@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [nilfs?] KASAN: use-after-free Read in nilfs_find_entry
calc last byte dec reclen overflow ?
#syz test
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index a8602729586a..f014b7fed5ce 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -317,7 +317,10 @@ struct nilfs_dir_entry *nilfs_find_entry(struct inode *dir,
de = (struct nilfs_dir_entry *)kaddr;
kaddr += nilfs_last_byte(dir, n) - reclen;
- while ((char *)de <= kaddr) {
+ printk("isize: %u, n: %lu, last byte: %u, reclen: %u, %s\n", dir->i_size, n, nilfs_last_byte(dir, n), reclen, __func__);
+ if (nilfs_last_byte(dir, n) < reclen)
+ break;
+ while ((char *)de + sizeof(*de) <= kaddr) {
if (de->rec_len == 0) {
nilfs_error(dir->i_sb,
"zero-length directory entry");
Powered by blists - more mailing lists