aboutsummaryrefslogtreecommitdiff
path: root/fs/jfs
diff options
context:
space:
mode:
authorManas Ghandat <[email protected]>2023-10-25 11:39:07 +0530
committerDave Kleikamp <[email protected]>2023-11-21 15:26:33 -0600
commitfa5492ee89463a7590a1449358002ff7ef63529f (patch)
treea28d2b719915c1629e668ceb98de07048578a4c3 /fs/jfs
parent27e56f59bab5ddafbcfe69ad7a4a6ea1279c1b16 (diff)
jfs: fix slab-out-of-bounds Read in dtSearch
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 <[email protected]> Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Manas Ghandat <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
Diffstat (limited to 'fs/jfs')
-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 f3d3e8b3f50c..031d8f570f58 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 =