From: Daiki Harada <daiky0325@gmail.com>
To: jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: Dave Kleikamp <shaggy@kernel.org>,
Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>, Kees Cook <kees@kernel.org>,
Daiki Harada <daiky0325@gmail.com>,
syzbot+32ec8b5bd050c78741c2@syzkaller.appspotmail.com
Subject: [PATCH] jfs: check sb_set_blocksize() return value in jfs_fill_super()
Date: Thu, 14 May 2026 16:07:00 +0000 [thread overview]
Message-ID: <20260514160700.376172-1-daiky0325@gmail.com> (raw)
jfs_fill_super() does not check the return value of sb_set_blocksize().
If the block device's logical block size exceeds PAGE_SIZE,
sb_set_blocksize() fails and returns 0, but jfs_fill_super() continues
regardless. Subsequent sb_bread() calls then trigger a BUG() in
folio_alloc_buffers() because the block size is incompatible with the
folio size.
Fix by checking the return value of sb_set_blocksize() and failing the
mount with -EINVAL if it returns 0.
Reported-by: syzbot+32ec8b5bd050c78741c2@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=32ec8b5bd050c78741c2
Signed-off-by: Daiki Harada <daiky0325@gmail.com>
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 61575f7397ae..c69fc7677a66 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -491,8 +491,12 @@ static int jfs_fill_super(struct super_block *sb, struct fs_context *fc)
/*
* Initialize blocksize to 4K.
*/
- sb_set_blocksize(sb, PSIZE);
-
+ if (!sb_set_blocksize(sb, PSIZE)) {
+ jfs_err("block size %lu > page size %lu not supported",
+ sb->s_blocksize, PAGE_SIZE);
+ ret = -EINVAL;
+ goto out_unload;
+ }
/*
* Set method vectors.
*/
---
reply other threads:[~2026-05-14 16:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260514160700.376172-1-daiky0325@gmail.com \
--to=daiky0325@gmail.com \
--cc=brauner@kernel.org \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=syzbot+32ec8b5bd050c78741c2@syzkaller.appspotmail.com \
--cc=viro@zeniv.linux.org.uk \
/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