[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230926071312.14086-1-ghandatmanas@gmail.com>
Date: Tue, 26 Sep 2023 12:43:12 +0530
From: Manas Ghandat <ghandatmanas@...il.com>
To: shaggy@...nel.org
Cc: Manas Ghandat <ghandatmanas@...il.com>,
jfs-discussion@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
Linux-kernel-mentees@...ts.linuxfoundation.org
Subject: [PATCH] jfs: fix array-index-out-of-bounds in diAlloc
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@...il.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
Powered by blists - more mailing lists