From: syzbot <syzbot+47ecc948aadfb2ab3efc@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Write in bch2_dev_journal_init
Date: Sun, 18 Aug 2024 22:37:42 -0700 [thread overview]
Message-ID: <0000000000003b49e0062002b5d3@google.com> (raw)
In-Reply-To: <00000000000071b7c5061ff83639@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: Re: [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Write in bch2_dev_journal_init
Author: lizhi.xu@windriver.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);
}
next prev parent reply other threads:[~2024-08-19 5:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-18 17:06 [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Write in bch2_dev_journal_init syzbot
2024-08-19 3:02 ` [syzbot] " syzbot
2024-08-19 3:27 ` syzbot
2024-08-19 5:37 ` syzbot [this message]
2024-08-19 6:47 ` [PATCH] bcachefs: Fix oob " Lizhi Xu
2024-08-19 7:05 ` Kent Overstreet
2024-08-20 7:11 ` [PATCH V2] bcachefs: Add journal v2 entry nr value check Lizhi Xu
2024-08-20 23:34 ` Kent Overstreet
2024-08-21 2:33 ` Lizhi Xu
2024-08-21 2:55 ` Kent Overstreet
2024-08-21 2:57 ` [PATCH V3] " Lizhi Xu
2024-08-21 3:00 ` Kent Overstreet
2024-08-21 3:10 ` Lizhi Xu
2024-08-21 3:16 ` Kent Overstreet
2024-08-21 3:19 ` Kent Overstreet
2024-08-21 3:30 ` Lizhi Xu
2024-08-19 15:17 ` [PATCH] bcachefs: Fix oob in bch2_dev_journal_init kernel test robot
2024-08-19 19:45 ` kernel test robot
2024-08-22 3:03 ` [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Write " Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0000000000003b49e0062002b5d3@google.com \
--to=syzbot+47ecc948aadfb2ab3efc@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.