From: "heming.zhao@suse.com" <heming.zhao@suse.com>
To: syzbot <syzbot+18a87160c7d64ba2e2f6@syzkaller.appspotmail.com>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>,
linux-kernel@vger.kernel.org, ocfs2-devel@lists.linux.dev,
Mohammed Anees <pvmohammedanees2003@gmail.com>,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [ocfs2?] kernel BUG in ocfs2_write_cluster_by_desc
Date: Mon, 23 Sep 2024 16:15:53 +0800 [thread overview]
Message-ID: <0a4b798a-db82-40da-9167-141b684f43fa@suse.com> (raw)
In-Reply-To: <0000000000005ef449062240d69c@google.com>
Regarding the mail thread: [PATCH 2/2] osfs2: Fix kernel BUG in ocfs2_write_cluster
Both ocfs2_search_chain and ocfs2_search_one_group call ocfs2_cluster_group_search to search for an extent cluster block. It seems that the ocfs2_cluster_group_search() sets wrong res->sr_bit_offset.
Just from the code logic, in ocfs2_block_group_find_clear_bits(), the ocfs2_find_next_zero_bit() returns ZERO which can trigger this bug. But in the real world, this function never return 0, because the 0-bit is always set to 1 for the cluster-group itself.
let's verify my thoughts.
#syz test
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index f7b483f0de2a..d4e563281c9e 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -1346,13 +1346,17 @@ static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb,
/* best_size will be allocated, we save prev_best_size */
res->sr_max_contig_bits = prev_best_size;
- if (best_size) {
- res->sr_bit_offset = best_offset;
- res->sr_bits = best_size;
- } else {
+ if (!best_size) {
status = -ENOSPC;
- /* No error log here -- see the comment above
- * ocfs2_test_bg_bit_allocatable */
+ } else {
+ if (best_size) {
+ res->sr_bit_offset = best_offset;
+ res->sr_bits = best_size;
+ } else {
+ status = -ENOSPC;
+ /* No error log here -- see the comment above
+ * ocfs2_test_bg_bit_allocatable */
+ }
}
return status;
next prev parent reply other threads:[~2024-09-23 8:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 18:35 syzbot
2024-09-17 16:26 ` [syzbot] " syzbot
2024-09-18 15:22 ` syzbot
2024-09-18 15:53 ` syzbot
2024-09-23 8:15 ` heming.zhao [this message]
2024-09-23 8:31 ` [syzbot] [ocfs2?] " syzbot
[not found] <CAABpPxQfOeRrSwxu3NZCVRQUcEguEqabK6DJ9GPFJ2twY+EdPw@mail.gmail.com>
2024-09-17 16:41 ` syzbot
[not found] <CAABpPxQ3+-wyEeGsVc+9ihNxDGFUFVQSWHKHSJnVQH6jSfYoRQ@mail.gmail.com>
2024-09-18 15:38 ` syzbot
[not found] <CAABpPxTDRvwd_Z4TV7-iba9t1xjWqg3HU+vfZ-XEa0O2ALpqaQ@mail.gmail.com>
2024-09-18 16:14 ` syzbot
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=0a4b798a-db82-40da-9167-141b684f43fa@suse.com \
--to=heming.zhao@suse.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ocfs2-devel@lists.linux.dev \
--cc=pvmohammedanees2003@gmail.com \
--cc=syzbot+18a87160c7d64ba2e2f6@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®