mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
To: syzbot+4f9c823a6f63d87491ba@syzkaller.appspotmail.com
Cc: jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, shaggy@kernel.org,
	syzkaller-bugs@googlegroups.com,
	Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
Subject: [PATCH] jfs: Add check for array bounds in dtDelete
Date: Thu, 18 Sep 2025 18:04:14 -0300	[thread overview]
Message-ID: <20250918210414.15022-1-pedrodemargomes@gmail.com> (raw)
In-Reply-To: <67d9cf78.050a0220.3657bb.000f.GAE@google.com>

#syz test

---
 fs/jfs/jfs_dtree.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index ab11849cf9cc..b30f57304c09 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -2129,6 +2129,14 @@ int dtDelete(tid_t tid,
 					next_index = -1;
 				else {
 					stbl = DT_GETSTBL(np);
+					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));
+						DT_PUTPAGE(nmp);
+						DT_PUTPAGE(mp);
+						return -EIO;
+					}
+
 					ldtentry =
 					    (struct ldtentry *) & np->
 					    slot[stbl[0]];
-- 
2.39.5


  parent reply	other threads:[~2025-09-18 21:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 19:54 [syzbot] [jfs?] UBSAN: array-index-out-of-bounds " syzbot
2025-04-18  3:25 ` [syzbot] " syzbot
2025-09-18 21:04 ` Pedro Demarchi Gomes [this message]
2025-09-18 21:27   ` syzbot
2025-09-19 15:23 ` Forwarded: " syzbot
2025-09-19 22:50 [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=20250918210414.15022-1-pedrodemargomes@gmail.com \
    --to=pedrodemargomes@gmail.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaggy@kernel.org \
    --cc=syzbot+4f9c823a6f63d87491ba@syzkaller.appspotmail.com \
    --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

all inboxes | Powered by JetHome®