Skip to contentSkip to conversation

CVE-2022-49334: mm/huge_memory: Fix xarray node memory leak

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Feb 26, 2025

lore
Share & tools
lore
#0 lore raw

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

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

mm/huge_memory: Fix xarray node memory leak

If xas_split_alloc() fails to allocate the necessary nodes to complete the xarray entry split, it sets the xa_state to -ENOMEM, which xas_nomem() then interprets as "Please allocate more memory", not as "Please free any unnecessary memory" (which was the intended outcome). It's confusing to use xas_nomem() to free memory in this context, so call xas_destroy() instead.

The Linux kernel CVE team has assigned CVE-2022-49334 to this issue.

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

	Issue introduced in 5.17 with commit 6b24ca4a1a8d4ee3221d6d44ddbb99f542e4bda3 and fixed in 5.17.15 with commit c0c84962e297927ba57fd6ddc2bb000c9d149655
	Issue introduced in 5.17 with commit 6b24ca4a1a8d4ee3221d6d44ddbb99f542e4bda3 and fixed in 5.18.4 with commit 95c8181b4947e000f3b9b8e5918d899fce77b93d
	Issue introduced in 5.17 with commit 6b24ca4a1a8d4ee3221d6d44ddbb99f542e4bda3 and fixed in 5.19 with commit 69a37a8ba1b408a1c7616494aa7018e4b3844cbe

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-2022-49334

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:
include/linux/xarray.h
lib/xarray.c
mm/huge_memory.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/c0c84962e297927ba57fd6ddc2bb000c9d149655
	https://git.kernel.org/stable/c/95c8181b4947e000f3b9b8e5918d899fce77b93d
	https://git.kernel.org/stable/c/69a37a8ba1b408a1c7616494aa7018e4b3844cbe