Skip to content

Commit ca84a2c

Browse files
ghanshyam1898kleikamp
authored andcommitted
jfs: array-index-out-of-bounds fix in dtReadFirst
The value of stbl can be sometimes out of bounds due to a bad filesystem. Added a check with appopriate return of error code in that case. Reported-by: syzbot+65fa06e29859e41a83f3@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=65fa06e29859e41a83f3 Signed-off-by: Ghanshyam Agrawal <ghanshyam1898@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
1 parent e42b1a9 commit ca84a2c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/jfs/jfs_dtree.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3086,6 +3086,13 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack)
30863086

30873087
/* get the leftmost entry */
30883088
stbl = DT_GETSTBL(p);
3089+
3090+
if (stbl[0] < 0 || stbl[0] > 127) {
3091+
DT_PUTPAGE(mp);
3092+
jfs_error(ip->i_sb, "stbl[0] out of bound\n");
3093+
return -EIO;
3094+
}
3095+
30893096
xd = (pxd_t *) & p->slot[stbl[0]];
30903097

30913098
/* get the child page block address */

0 commit comments

Comments
 (0)