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+4f9c823a6f63d87491ba@syzkaller.appspotmail.com
Subject: [PATCH] jfs: Add check for array bounds in dtDelete
Date: Fri, 19 Sep 2025 19:50:55 -0300 [thread overview]
Message-ID: <20250919225055.106808-1-pedrodemargomes@gmail.com> (raw)
stbl is s8 but it must contain offsets into slot which can go from 0 to
127.
Add a bound check for that error inside dtDelete function.
Reported-by: syzbot+4f9c823a6f63d87491ba@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4f9c823a6f63d87491ba
Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
---
fs/jfs/jfs_dtree.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index ab11849cf9cc..c200b37f4562 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -2129,11 +2129,17 @@ int dtDelete(tid_t tid,
next_index = -1;
else {
stbl = DT_GETSTBL(np);
- ldtentry =
- (struct ldtentry *) & np->
- slot[stbl[0]];
- next_index =
- le32_to_cpu(ldtentry->index);
+ if (stbl[0] < 0 || stbl[0] >= DTPAGEMAXSLOT) {
+ jfs_err("JFS: Invalid stbl[0] = %d for inode %ld, block = %lld",
+ stbl[0], (long)ip->i_ino, (long long)le64_to_cpu(p->header.next));
+ next_index = -1;
+ } else {
+ ldtentry =
+ (struct ldtentry *) & np->
+ slot[stbl[0]];
+ next_index =
+ le32_to_cpu(ldtentry->index);
+ }
DT_PUTPAGE(nmp);
}
}
--
2.39.5
next reply other threads:[~2025-09-19 22:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 22:50 Pedro Demarchi Gomes [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-03-18 19:54 [syzbot] [jfs?] UBSAN: array-index-out-of-bounds " syzbot
2025-09-18 21:04 ` [PATCH] jfs: Add check for array bounds " Pedro Demarchi Gomes
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=20250919225055.106808-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+4f9c823a6f63d87491ba@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®