Skip to content

Commit 2741a8c

Browse files
jfs: Fix array-index-out-of-bounds in diFree
jira VULN-44735 cve CVE-2024-43858 commit-author Jeongjun Park <aha310510@gmail.com> commit f73f969 Reported-by: syzbot+241c815bda521982cb49@syzkaller.appspotmail.com Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Jeongjun Park <aha310510@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> (cherry picked from commit f73f969) Signed-off-by: Pratham Patel <ppatel@ciq.com>
1 parent a861dfd commit 2741a8c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/jfs/jfs_imap.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ int diSync(struct inode *ipimap)
304304
int diRead(struct inode *ip)
305305
{
306306
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
307-
int iagno, ino, extno, rc;
307+
int iagno, ino, extno, rc, agno;
308308
struct inode *ipimap;
309309
struct dinode *dp;
310310
struct iag *iagp;
@@ -353,8 +353,11 @@ int diRead(struct inode *ip)
353353

354354
/* get the ag for the iag */
355355
agstart = le64_to_cpu(iagp->agstart);
356+
agno = BLKTOAG(agstart, JFS_SBI(ip->i_sb));
356357

357358
release_metapage(mp);
359+
if (agno >= MAXAG || agno < 0)
360+
return -EIO;
358361

359362
rel_inode = (ino & (INOSPERPAGE - 1));
360363
pageno = blkno >> sbi->l2nbperpage;

0 commit comments

Comments
 (0)