jfs: fix shift-out-of-bounds in dbSplit

[ Upstream commit a5f5e4698f8abbb25fe4959814093fb5bfa1aa9d ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Ghanshyam Agrawal 2024-09-30 13:42:18 +05:30 committed by Greg Kroah-Hartman
parent 25f1e673ef
commit bbb24ce7f0

View file

@ -1886,6 +1886,9 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
return -EIO; return -EIO;
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
if (dp->tree.budmin < 0)
return -EIO;
/* try to allocate the blocks. /* try to allocate the blocks.
*/ */
rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results); rc = dbAllocDmapLev(bmp, dp, (int) nblocks, l2nb, results);