mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "1016331059@qq.com" <1016331059@qq.com>
To: "syzbot+c6104ecfe56e0fd6b616@syzkaller.appspotmail.com"
	<syzbot+c6104ecfe56e0fd6b616@syzkaller.appspotmail.com>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>,
	"mark@fasheh.com" <mark@fasheh.com>,
	"jlbec@evilplan.org" <jlbec@evilplan.org>,
	"joseph.qi@linux.alibaba.com" <joseph.qi@linux.alibaba.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [syzbot] ocfs2: shift-out-of-bounds UBSAN bug in ocfs2_verify_volume
Date: Mon, 23 Mar 2026 12:38:51 +0000	[thread overview]
Message-ID: <tencent_7C51DF11EF9B2F12D8AE4595C0F91009A405@qq.com> (raw)

Hi Syzbot,

This patch is a fix for the bug reported by you.
Bug ID: c6104ecfe56e0fd6b616
Link: https://syzkaller.appspot.com/bug?extid=c6104ecfe56e0fd6b616

This patch is a backport to stable 5.15.y of upstream commit
7f86b2942791012ac7b4c481d1f84a58fd2fbcfc
("ocfs2: fix shift-out-of-bounds UBSAN bug in ocfs2_verify_volume()").

Please test it on the public 5.15.y tree below.

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git 3330a8d33e086f76608bb4e80a3dc569d04a8814

From ae310006fc6e06c233b8d6780b2a2c6a16d6d708 Mon Sep 17 00:00:00 2001
From: Changjian Liu <driz2t@qq.com>
Date: Mon, 23 Mar 2026 11:39:19 +0800
Subject: [PATCH] ocfs2: fix shift-out-of-bounds UBSAN bug in
 ocfs2_verify_volume()

This patch is a backport to stable 5.15.y of upstream commit
7f86b2942791012ac7b4c481d1f84a58fd2fbcfc
("ocfs2: fix shift-out-of-bounds UBSAN bug in ocfs2_verify_volume()").

This patch addresses a shift-out-of-bounds error in the
ocfs2_verify_volume() function, identified by UBSAN. The bug was
triggered by an invalid s_clustersize_bits value (e.g., 1548), which
caused the expression

  1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits)

to exceed the limits of a 32-bit integer, leading to an out-of-bounds
shift.

Instead of shifting by an invalid bit count while reporting the error,
log the raw s_clustersize_bits value directly.

[ Upstream commit 7f86b2942791012ac7b4c481d1f84a58fd2fbcfc ]
---
 fs/ocfs2/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index bb174009206e..ae2ba616756d 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2369,8 +2369,8 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
                  (unsigned long long)bh->b_blocknr);
         } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 ||
                 le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) {
-            mlog(ML_ERROR, "bad cluster size found: %u\n",
-                 1 << le32_to_cpu(di->id2.i_super.s_clustersize_bits));
+            mlog(ML_ERROR, "bad cluster size bit found: %u\n",
+                 le32_to_cpu(di->id2.i_super.s_clustersize_bits));
         } else if (!le64_to_cpu(di->id2.i_super.s_root_blkno)) {
             mlog(ML_ERROR, "bad root_blkno: 0\n");
         } else if (!le64_to_cpu(di->id2.i_super.s_system_dir_blkno)) {
-- 
2.43.0

Thanks,
Changjian Liu


             reply	other threads:[~2026-03-23 12:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 12:38 1016331059 [this message]
2026-03-23 13:16 ` [v5.15] UBSAN: shift-out-of-bounds in ocfs2_fill_super syzbot
2026-03-24  3:23 [syzbot] ocfs2: shift-out-of-bounds UBSAN bug in ocfs2_verify_volume 1016331059

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=tencent_7C51DF11EF9B2F12D8AE4595C0F91009A405@qq.com \
    --to=1016331059@qq.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+c6104ecfe56e0fd6b616@syzkaller.appspotmail.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®