diff options
author | Ghanshyam Agrawal <ghanshyam1898@gmail.com> | 2024-09-28 14:07:22 +0530 |
---|---|---|
committer | Dave Kleikamp <dave.kleikamp@oracle.com> | 2024-10-29 16:13:36 -0500 |
commit | ca84a2c9be482836b86d780244f0357e5a778c46 (patch) | |
tree | 4fe5c7e0ddf1c078e96aa27d020476c621c77655 /fs/jfs | |
parent | e42b1a9a2557aa94fee47f078633677198386a52 (diff) | |
download | lwn-ca84a2c9be482836b86d780244f0357e5a778c46.tar.gz lwn-ca84a2c9be482836b86d780244f0357e5a778c46.zip |
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>
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/jfs_dtree.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 5d3127ca68a4..69fd936fbdb3 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -3086,6 +3086,13 @@ static int dtReadFirst(struct inode *ip, struct btstack * btstack) /* get the leftmost entry */ stbl = DT_GETSTBL(p); + + if (stbl[0] < 0 || stbl[0] > 127) { + DT_PUTPAGE(mp); + jfs_error(ip->i_sb, "stbl[0] out of bound\n"); + return -EIO; + } + xd = (pxd_t *) & p->slot[stbl[0]]; /* get the child page block address */ |