From: Manas Ghandat <ghandatmanas@gmail.com>
To: shaggy@kernel.org
Cc: Manas Ghandat <ghandatmanas@gmail.com>,
jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH] jfs: fix array-index-out-of-bounds in diAlloc
Date: Tue, 26 Sep 2023 12:43:12 +0530 [thread overview]
Message-ID: <20230926071312.14086-1-ghandatmanas@gmail.com> (raw)
Currently there is not check against the agno of the iag while
allocating new inodes to avoid fragmentation problem. Added the check
which is required.
Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
---
fs/jfs/jfs_imap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 799d3837e7c2..ace8a1506380 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -1355,6 +1355,8 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
/* get the ag number of this iag */
agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb));
+ if (agno < 0)
+ return -EIO;
if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
/*
--
2.37.2
next reply other threads:[~2023-09-26 7:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 7:13 Manas Ghandat [this message]
2023-10-02 4:35 ` Manas Ghandat
2023-10-03 23:22 ` 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=20230926071312.14086-1-ghandatmanas@gmail.com \
--to=ghandatmanas@gmail.com \
--cc=Linux-kernel-mentees@lists.linuxfoundation.org \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@kernel.org \
/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®