diff options
author | Siddh Raman Pant <[email protected]> | 2023-06-20 22:17:00 +0530 |
---|---|---|
committer | Dave Kleikamp <[email protected]> | 2023-06-20 12:37:50 -0500 |
commit | 11509910c599cbd04585ec35a6d5e1a0053d84c1 (patch) | |
tree | 76343f909d266e603c784eed0336a0594d10e5f1 /lib/mpi/mpi-inline.h | |
parent | 692b7dc87ca6d55ab254f8259e6f970171dc9d01 (diff) |
jfs: jfs_dmap: Validate db_l2nbperpage while mounting
In jfs_dmap.c at line 381, BLKTODMAP is used to get a logical block
number inside dbFree(). db_l2nbperpage, which is the log2 number of
blocks per page, is passed as an argument to BLKTODMAP which uses it
for shifting.
Syzbot reported a shift out-of-bounds crash because db_l2nbperpage is
too big. This happens because the large value is set without any
validation in dbMount() at line 181.
Thus, make sure that db_l2nbperpage is correct while mounting.
Max number of blocks per page = Page size / Min block size
=> log2(Max num_block per page) = log2(Page size / Min block size)
= log2(Page size) - log2(Min block size)
=> Max db_l2nbperpage = L2PSIZE - L2MINBLOCKSIZE
Reported-and-tested-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?id=2a70a453331db32ed491f5cbb07e81bf2d225715
Cc: [email protected]
Suggested-by: Dave Kleikamp <[email protected]>
Signed-off-by: Siddh Raman Pant <[email protected]>
Signed-off-by: Dave Kleikamp <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-inline.h')
0 files changed, 0 insertions, 0 deletions