jfs: jfs_dmap: Validate db_l2nbperpage while mounting
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 · < c7feb54b113802d2aba98708769d3c33fb017254| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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
From the CVE record · Linux
The Linux kernel's JFS code does not validate db_l2nbperpage while mounting a filesystem. An attacker who can cause a JFS filesystem with an invalid value to be mounted may trigger a shift-out-of-bounds crash. The input does not specify whether authentication is needed; mounting the filesystem is the required interaction.
Engineers running the Linux kernel with JFS support should check their systems; affected versions are not specified.