[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240425143755.47655-1-aha310510@gmail.com>
Date: Thu, 25 Apr 2024 23:37:55 +0900
From: Jeongjun Park <aha310510@...il.com>
To: willy@...radead.org
Cc: brauner@...nel.org,
jfs-discussion@...ts.sourceforge.net,
jlayton@...nel.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
shaggy@...nel.org,
syzbot+241c815bda521982cb49@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com,
Jeongjun Park <aha310510@...il.com>
Subject: Re: [PATCH] jfs: Fix array-index-out-of-bounds in diFree
Matthew Wilcox wrote:
> It should be checked earlier than this. There's this code in
> dbMount(). Why isn't this catching it?
Send final patch. With the patch that modified the location of
release_metapage(), out-of-bounds vulnerabilities can now be
sufficiently prevented.
Reported-by: syzbot+241c815bda521982cb49@...kaller.appspotmail.com
Signed-off-by: Jeongjun Park <aha310510@...il.com>
---
fs/jfs/jfs_imap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 2ec35889ad24..cad1798dc892 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -290,7 +290,7 @@ int diSync(struct inode *ipimap)
int diRead(struct inode *ip)
{
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
- int iagno, ino, extno, rc;
+ int iagno, ino, extno, rc, agno;
struct inode *ipimap;
struct dinode *dp;
struct iag *iagp;
@@ -339,8 +339,11 @@ int diRead(struct inode *ip)
/* get the ag for the iag */
agstart = le64_to_cpu(iagp->agstart);
+ agno = BLKTOAG(agstart, JFS_SBI(ip->i_sb));
release_metapage(mp);
+ if(agno >= MAXAG || agno < 0)
+ return -EIO;
rel_inode = (ino & (INOSPERPAGE - 1));
pageno = blkno >> sbi->l2nbperpage;
--
2.34.1
Powered by blists - more mailing lists