Subject: CVE-2023-52799: jfs: fix array-index-out-of-bounds in dbFindLeaf

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

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

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

jfs: fix array-index-out-of-bounds in dbFindLeaf

Currently while searching for dmtree_t for sufficient free blocks there
is an array out of bounds while getting element in tp->dm_stree. To add
the required check for out of bound we first need to determine the type
of dmtree. Thus added an extra parameter to dbFindLeaf so that the type
of tree can be determined and the required check can be applied.

The Linux kernel CVE team has assigned CVE-2023-52799 to this issue.

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

	Fixed in 4.14.331 with commit 20f9310a18e3
	Fixed in 4.19.300 with commit 86df90f3fea7
	Fixed in 5.4.262 with commit ecfb47f13b08
	Fixed in 5.10.202 with commit 81aa58cd8495
	Fixed in 5.15.140 with commit da3da5e1e6f7
	Fixed in 6.1.64 with commit a50b796d3671
	Fixed in 6.5.13 with commit 88b7894a8f87
	Fixed in 6.6.3 with commit 87c681ab49e9
	Fixed in 6.7 with commit 22cad8bc1d36

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-2023-52799
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/20f9310a18e3e99fc031e036fcbed67105ae1859
	https://git.kernel.org/stable/c/86df90f3fea7c5591f05c8a0010871d435e83046
	https://git.kernel.org/stable/c/ecfb47f13b08b02cf28b7b50d4941eefa21954d2
	https://git.kernel.org/stable/c/81aa58cd8495b8c3b527f58ccbe19478d8087f61
	https://git.kernel.org/stable/c/da3da5e1e6f71c21d8e6149d7076d936ef5d4cb9
	https://git.kernel.org/stable/c/a50b796d36719757526ee094c703378895ab5e67
	https://git.kernel.org/stable/c/88b7894a8f8705bf4e7ea90b10229376abf14514
	https://git.kernel.org/stable/c/87c681ab49e99039ff2dd3e71852417381b13878
	https://git.kernel.org/stable/c/22cad8bc1d36547cdae0eef316c47d917ce3147c