mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] jfs: fix array-index-out-of-bounds in diAlloc
@ 2023-09-26  7:13 Manas Ghandat
  2023-10-02  4:35 ` Manas Ghandat
  2023-10-03 23:22 ` Dave Kleikamp
  0 siblings, 2 replies; 3+ messages in thread
From: Manas Ghandat @ 2023-09-26  7:13 UTC (permalink / raw)
  To: shaggy; +Cc: Manas Ghandat, jfs-discussion, linux-kernel, Linux-kernel-mentees

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-03 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26  7:13 [PATCH] jfs: fix array-index-out-of-bounds in diAlloc Manas Ghandat
2023-10-02  4:35 ` Manas Ghandat
2023-10-03 23:22 ` Dave Kleikamp

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®