[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0000000000003b49e0062002b5d3@google.com>
Date: Sun, 18 Aug 2024 22:37:42 -0700
From: syzbot <syzbot+47ecc948aadfb2ab3efc@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Write
in bch2_dev_journal_init
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: Re: [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Write in bch2_dev_journal_init
Author: lizhi.xu@...driver.com
two obj are null ?
#syz test: upstream c3f2d783a459
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 13669dd0e375..d6970d834991 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -1307,8 +1307,18 @@ int bch2_dev_journal_init(struct bch_dev *ca, struct bch_sb *sb)
if (journal_buckets_v2) {
unsigned nr = bch2_sb_field_journal_v2_nr_entries(journal_buckets_v2);
- for (unsigned i = 0; i < nr; i++)
+ for (unsigned i = 0; i < nr; i++) {
ja->nr += le64_to_cpu(journal_buckets_v2->d[i].nr);
+ if (le64_to_cpu(journal_buckets_v2->d[i].nr) > UINT_MAX) {
+ struct bch_fs *c = ca->fs;
+ struct printbuf buf = PRINTBUF;
+ prt_printf(&buf, "v2d[%u]: %lu overflow!\n", i,
+ le64_to_cpu(journal_buckets_v2->d[i].nr));
+ bch_info(c, "%s", buf.buf);
+ printbuf_exit(&buf);
+ return -BCH_ERR_ENOMEM_dev_journal_init;
+ }
+ }
} else if (journal_buckets) {
ja->nr = bch2_nr_journal_buckets(journal_buckets);
}
Powered by blists - more mailing lists