Subject: CVE-2024-49902: jfs: check if leafidx greater than num leaves per dmap tree

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

jfs: check if leafidx greater than num leaves per dmap tree

syzbot report a out of bounds in dbSplit, it because dmt_leafidx greater
than num leaves per dmap tree, add a checking for dmt_leafidx in dbFindLeaf.

Shaggy:
Modified sanity check to apply to control pages as well as leaf pages.

The Linux kernel CVE team has assigned CVE-2024-49902 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.10.227 with commit 2451e5917c56
	Fixed in 5.15.168 with commit 25d2a3ff02f2
	Fixed in 6.1.113 with commit 058aa89b3318
	Fixed in 6.6.55 with commit 7fff9a9f866e
	Fixed in 6.10.14 with commit cb0eb1055880
	Fixed in 6.11.3 with commit 4a7bf6a01fb4
	Fixed in 6.12-rc1 with commit d64ff0d23067

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-49902
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	fs/jfs/jfs_dmap.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/2451e5917c56be45d4add786e2a059dd9c2c37c4
	https://git.kernel.org/stable/c/25d2a3ff02f22e215ce53355619df10cc5faa7ab
	https://git.kernel.org/stable/c/058aa89b3318be3d66a103ba7c68d717561e1dc6
	https://git.kernel.org/stable/c/7fff9a9f866e99931cf6fa260288e55d01626582
	https://git.kernel.org/stable/c/cb0eb10558802764f07de1dc439c4609e27cb4f0
	https://git.kernel.org/stable/c/4a7bf6a01fb441009a6698179a739957efd88e38
	https://git.kernel.org/stable/c/d64ff0d2306713ff084d4b09f84ed1a8c75ecc32