CVE-2024-40936: cxl/region: Fix memregion leaks in devm_cxl_add_region()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
cxl/region: Fix memregion leaks in devm_cxl_add_region()
Move the mode verification to __create_region() before allocating the memregion to avoid the memregion leaks.
The Linux kernel CVE team has assigned CVE-2024-40936 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.3 with commit 6e099264185d and fixed in 6.6.35 with commit d8316838aa06 Issue introduced in 6.3 with commit 6e099264185d and fixed in 6.9.6 with commit bbb5d8746381 Issue introduced in 6.3 with commit 6e099264185d and fixed in 6.10-rc3 with commit 49ba7b515c4c
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-40936
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:
drivers/cxl/core/region.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/d8316838aa0686da63a8be4194b7a17b0103ae4a https://git.kernel.org/stable/c/bbb5d8746381c82f7e0fb6171094d375b492f266 https://git.kernel.org/stable/c/49ba7b515c4c0719b866d16f068e62d16a8a3dd1