From: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
To: shaggy@kernel.org, duttaditya18@gmail.com, ghanshyam1898@gmail.com
Cc: jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Pedro Demarchi Gomes <pedrodemargomes@gmail.com>,
syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com
Subject: [PATCH] jfs: fix im_l2nbperiext shift out of bounds
Date: Wed, 24 Sep 2025 23:58:54 -0300 [thread overview]
Message-ID: <20250925025854.8061-1-pedrodemargomes@gmail.com> (raw)
When reading im_l2nbperiext from disk, check if its value is valid.
Since im_l2nbperiext is the log2 of a 32 bit number, its maximum value is 31.
Reported-by: syzbot+13ba7f3e9a17f77250fe@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=13ba7f3e9a17f77250fe
Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
---
fs/jfs/jfs_imap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index ecb8e05b8b84..6abeb78c9eb4 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -124,6 +124,10 @@ int diMount(struct inode *ipimap)
atomic_set(&imap->im_numfree, le32_to_cpu(dinom_le->in_numfree));
imap->im_nbperiext = le32_to_cpu(dinom_le->in_nbperiext);
imap->im_l2nbperiext = le32_to_cpu(dinom_le->in_l2nbperiext);
+ if (imap->im_l2nbperiext > 31) {
+ jfs_err("diMount: invalid im_l2nbperiext");
+ return -EIO;
+ }
for (index = 0; index < MAXAG; index++) {
imap->im_agctl[index].inofree =
le32_to_cpu(dinom_le->in_agctl[index].inofree);
--
2.39.5
reply other threads:[~2025-09-25 3:06 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=20250925025854.8061-1-pedrodemargomes@gmail.com \
--to=pedrodemargomes@gmail.com \
--cc=duttaditya18@gmail.com \
--cc=ghanshyam1898@gmail.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=syzbot+13ba7f3e9a17f77250fe@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®