summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorManas Ghandat <ghandatmanas@gmail.com>2023-10-25 09:09:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-23 10:24:55 +0300
commit1b9d6828589d57f94a23fb1c46112cda39d7efdb (patch)
treeb7ae4a20df2404e5e938e487e08ecedbc778506a /fs
parentfd3486a893778770557649fe28afa5e463d4ed07 (diff)
downloadlinux-1b9d6828589d57f94a23fb1c46112cda39d7efdb.tar.xz
jfs: fix slab-out-of-bounds Read in dtSearch
[ Upstream commit fa5492ee89463a7590a1449358002ff7ef63529f ] Currently while searching for current page in the sorted entry table of the page there is a out of bound access. Added a bound check to fix the error. Dave: Set return code to -EIO Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202310241724.Ed02yUz9-lkp@intel.com/ Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_dtree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index a6d42e49d156..077a87e53020 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -633,6 +633,11 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
for (base = 0, lim = p->header.nextindex; lim; lim >>= 1) {
index = base + (lim >> 1);
+ if (stbl[index] < 0) {
+ rc = -EIO;
+ goto out;
+ }
+
if (p->header.flag & BT_LEAF) {
/* uppercase leaf name to compare */
cmp =