android_kernel_motorola_sm6375/fs/jfs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Siddh Raman Pant a4855aeb13 jfs: jfs_dmap: Validate db_l2nbperpage while mounting
commit 11509910c599cbd04585ec35a6d5e1a0053d84c1 upstream.

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]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-07-27 08:37:35 +02:00
..
acl.c
file.c
inode.c jfs: prevent NULL deref in diFree 2022-04-15 14:18:36 +02:00
ioctl.c
jfs_acl.h
jfs_btree.h
jfs_debug.c
jfs_debug.h
jfs_dinode.h
jfs_discard.c
jfs_discard.h
jfs_dmap.c jfs: jfs_dmap: Validate db_l2nbperpage while mounting 2023-07-27 08:37:35 +02:00
jfs_dmap.h
jfs_dtree.c
jfs_dtree.h
jfs_extent.c
jfs_extent.h
jfs_filsys.h jfs: jfs_dmap: Validate db_l2nbperpage while mounting 2023-07-27 08:37:35 +02:00
jfs_imap.c
jfs_imap.h
jfs_incore.h
jfs_inode.c
jfs_inode.h
jfs_lock.h
jfs_logmgr.c
jfs_logmgr.h
jfs_metapage.c
jfs_metapage.h
jfs_mount.c
jfs_superblock.h
jfs_txnmgr.c
jfs_txnmgr.h
jfs_types.h
jfs_umount.c
jfs_unicode.c
jfs_unicode.h
jfs_uniupr.c
jfs_xattr.h
jfs_xtree.c
jfs_xtree.h
Kconfig
Makefile
namei.c
resize.c
super.c
symlink.c
xattr.c