From: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
To: shaggy@kernel.org, ghandatmanas@gmail.com, jlayton@kernel.org,
eadavis@qq.com, brauner@kernel.org, ghanshyam1898@gmail.com
Cc: jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
syzbot+808f3f84407f08a93022@syzkaller.appspotmail.com
Subject: [PATCH] jfs: fix array-index-out-of-bounds
Date: Sun, 22 Sep 2024 16:30:00 +0530 [thread overview]
Message-ID: <20240922110000.128650-1-ghanshyam1898@gmail.com> (raw)
In some cases, dn_numag may be greater than MAXAG which may
result in an array-index-out-of-bounds in dbNextAG. Added
a check to return an error code before we crash.
Reported-by: syzbot+808f3f84407f08a93022@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=808f3f84407f08a93022
Signed-off-by: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
---
fs/jfs/jfs_imap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 2ec35889ad24..5088da13e8f1 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -1360,6 +1360,9 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
if (agno < 0 || agno > dn_numag)
return -EIO;
+ if (unlikely(dn_numag > MAXAG))
+ return -EIO;
+
if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
/*
* There is an open file actively growing. We want to
--
2.34.1
next reply other threads:[~2024-09-22 11:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-22 11:00 Ghanshyam Agrawal [this message]
2024-09-22 15:05 ` Christophe JAILLET
2024-09-23 3:35 ` Ghanshyam Agrawal
2024-09-23 20:45 ` Christophe JAILLET
2024-09-24 4:52 ` Ghanshyam Agrawal
2024-09-24 13:39 ` Dave Kleikamp
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=20240922110000.128650-1-ghanshyam1898@gmail.com \
--to=ghanshyam1898@gmail.com \
--cc=brauner@kernel.org \
--cc=eadavis@qq.com \
--cc=ghandatmanas@gmail.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=syzbot+808f3f84407f08a93022@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®