[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_DAEC5ACEE079366E9C2C516E6C9568E9AA0A@qq.com>
Date: Tue, 30 Jul 2024 10:17:16 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+05d7520be047c9be86e0@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Read in journal_entry_dev_usage_to_text
entry bytes too small ?
#syz test: upstream 1722389b0d86
diff --git a/fs/bcachefs/sb-clean.c b/fs/bcachefs/sb-clean.c
index 47f10ab57f40..a10d3e6e8119 100644
--- a/fs/bcachefs/sb-clean.c
+++ b/fs/bcachefs/sb-clean.c
@@ -303,6 +303,7 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb,
for (entry = clean->start;
entry != vstruct_end(&clean->field);
entry = vstruct_next(entry)) {
+ unsigned bytes = vstruct_bytes(entry);
if ((void *) vstruct_next(entry) > vstruct_end(&clean->field))
break;
@@ -310,6 +311,11 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb,
!entry->u64s)
continue;
+ printk("entry bytes:%u, jedu: %u, %s\n", bytes,
+ sizeof(struct jset_entry_dev_usage), __func__);
+ if (bytes < sizeof(struct jset_entry_dev_usage))
+ continue;
+
bch2_journal_entry_to_text(out, NULL, entry);
prt_newline(out);
}
Powered by blists - more mailing lists