summaryrefslogtreecommitdiff
path: root/fs/jfs
diff options
context:
space:
mode:
authorGhanshyam Agrawal <ghanshyam1898@gmail.com>2024-09-30 13:42:18 +0530
committerDave Kleikamp <dave.kleikamp@oracle.com>2024-10-29 16:53:18 -0500
commita5f5e4698f8abbb25fe4959814093fb5bfa1aa9d (patch)
treead22c691338220732087cc7943d9daaf207e8113 /fs/jfs
parentca84a2c9be482836b86d780244f0357e5a778c46 (diff)
downloadlwn-a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d.tar.gz
lwn-a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d.zip
jfs: fix shift-out-of-bounds in dbSplit
When dmt_budmin is less than zero, it causes errors in the later stages. Added a check to return an error beforehand in dbAllocCtl itself. Reported-by: syzbot+b5ca8a249162c4b9a7d0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=b5ca8a249162c4b9a7d0 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_dmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 3ab410059dc2..39957361a7ee 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1820,6 +1820,9 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
return -EIO;
dp = (struct dmap *) mp->data;
+ if (dp->tree.budmin < 0)
+ return -EIO;
+
/* try to allocate the blocks.
*/
rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);