From: syzbot <syzbot+13e8cd4926977f8337b6@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] jfs: validate db_maxfreebud in extBalloc to prevent
Date: Fri, 17 Apr 2026 03:12:22 -0700 [thread overview]
Message-ID: <69e20786.050a0220.1de265.000f.GAE@google.com> (raw)
In-Reply-To: <0000000000002e9eb506178cdd71@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] jfs: validate db_maxfreebud in extBalloc to prevent
Author: tristmd@gmail.com
From: Tristan Madani <tristan@talencesecurity.com>
#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
shift-out-of-bounds
extBalloc() computes the maximum allocation size using:
max = (s64) 1 << bmp->db_maxfreebud;
where db_maxfreebud is an s8 read from the on-disk bmap structure.
A crafted JFS image can provide a value of 108, which exceeds the
maximum valid shift exponent for a 64-bit signed integer (63),
triggering a UBSAN shift-out-of-bounds error.
The value -1 is already handled as a sentinel for "no free space",
but no upper bound check exists. Add a validation check to return
-EIO when db_maxfreebud contains an out-of-range value, indicating
on-disk corruption.
Reported-by: syzbot+13e8cd4926977f8337b6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=13e8cd4926977f8337b6
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
fs/jfs/jfs_extent.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index XXXXXXX..XXXXXXX 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -326,6 +326,12 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
if (bmp->db_maxfreebud == -1)
return -ENOSPC;
+ if (bmp->db_maxfreebud < 0 || bmp->db_maxfreebud > 63) {
+ jfs_error(ip->i_sb,
+ "invalid db_maxfreebud: %d\n", bmp->db_maxfreebud);
+ return -EIO;
+ }
+
max = (s64) 1 << bmp->db_maxfreebud;
if (*nblocks >= max && *nblocks > nbperpage)
nb = nblks = (max > nbperpage) ? max : nbperpage;
--
2.43.0
next prev parent reply other threads:[~2026-04-17 10:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 13:40 [syzbot] [jfs?] UBSAN: shift-out-of-bounds in extAlloc (2) syzbot
2024-05-31 11:06 ` Jeongjun Park
2024-05-31 18:18 ` syzbot
2024-06-01 0:29 ` Changheon LEE
2024-06-01 2:56 ` Jeongjun Park
2024-06-01 3:00 ` Jeongjun Park
2024-06-01 3:31 ` syzbot
2025-09-28 2:54 ` Forwarded: " syzbot
2026-04-17 10:12 ` syzbot [this message]
2026-04-17 16:20 ` Forwarded: Re: [syzbot] UBSAN: shift-out-of-bounds in extBalloc 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=69e20786.050a0220.1de265.000f.GAE@google.com \
--to=syzbot+13e8cd4926977f8337b6@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--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