jfs: fix slab-out-of-bounds Read in dtSearch
PATCH v2 1/1 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.
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Manas Ghandat <[email protected]>
---
V1 -> V2 : Removed redundant check on stbl
fs/jfs/jfs_dtree.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/jfs_dtree.c +3 -0
@@ -633,6 +633,9 @@ 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 ) + goto out; +if (p->header.flag &BT_LEAF ) {/* uppercase leaf name to compare */ cmp =
Signature · 1 line
2.37.2
Quoted 3 lines · Manas Ghandat
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.
Looks good. I made the small change of setting rc = -EIO in that case, so we know there is something wrong with the file system.
Thanks,
Shaggy
Quoted 25 lines
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Manas Ghandat <[email protected]>---
V1 -> V2 : Removed redundant check on stblfs/jfs/jfs_dtree.c | 3 +++ 1 file changed, 3 insertions(+)fs/jfs/jfs_dtree.c +3
-0@@ -633,6 +633,9 @@ 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 ) + goto out; +if (p->header.flag &BT_LEAF ) {/* uppercase leaf name to compare */ cmp =