# CVE-2026-23137: of: unittest: Fix memory leak in unittest_data_add()

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.17%, higher than 7% of CVEs (2026-12-01)
- Published: 2026-02-14T15:22:22.690Z
- Modified: 2026-10-30T13:18:33.770Z
- Weaknesses: CWE-401
- Assigned by: Linux

## Description

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

of: unittest: Fix memory leak in unittest_data_add()

In unittest_data_add(), if of_resolve_phandles() fails, the allocated
unittest_data is not freed, leading to a memory leak.

Fix this by using scope-based cleanup helper __free(kfree) for automatic
resource cleanup. This ensures unittest_data is automatically freed when
it goes out of scope in error paths.

For the success path, use retain_and_null_ptr() to transfer ownership
of the memory to the device tree and prevent double freeing.

(As written by CVE List.)

## Affected

- Linux Linux: from 2eb46da2a760e5764c48b752a5ef320e02b96b21 before 4bafaec9e3a784d103ab9da11095708fcca70e76; from 2eb46da2a760e5764c48b752a5ef320e02b96b21 before 4c7ad40c285ab85e3614433e063f14aac2e2fe17; from 2eb46da2a760e5764c48b752a5ef320e02b96b21 before 58baf98d1bdab897fd796f39a16061bade229d71; from 2eb46da2a760e5764c48b752a5ef320e02b96b21 before f09b0f705bd7197863b90256ef533a6414d1db2c; from 2eb46da2a760e5764c48b752a5ef320e02b96b21 before 235a1eb8d2dcc49a6cf0a5ee1aa85544a5d0054b; 3.18 (not affected: before 3.18; from 6.1.191 up to 6.1.*; from 6.6.160 up to 6.6.*; from 6.12.110 up to 6.12.*; from 6.18.6 up to 6.18.*; from 6.19 up to *)
- linux linux_kernel: from 3.18 before 6.18.6; 6.19

## References

- <https://git.kernel.org/stable/c/4bafaec9e3a784d103ab9da11095708fcca70e76>
- <https://git.kernel.org/stable/c/4c7ad40c285ab85e3614433e063f14aac2e2fe17>
- <https://git.kernel.org/stable/c/58baf98d1bdab897fd796f39a16061bade229d71>
- <https://git.kernel.org/stable/c/f09b0f705bd7197863b90256ef533a6414d1db2c> (patch)
- <https://git.kernel.org/stable/c/235a1eb8d2dcc49a6cf0a5ee1aa85544a5d0054b> (patch)

## Sources

- CVE List: [CVE-2026-23137](https://www.cve.org/CVERecord?id=CVE-2026-23137), CVE Terms of Use, modified 2026-10-30
- NVD: [CVE-2026-23137](https://nvd.nist.gov/vuln/detail/CVE-2026-23137), Public domain, modified 2026-10-30

---

Page: https://cve.day/CVE-2026-23137 · Whole record: https://cve.day/CVE-2026-23137.json · Rebuilt by cve.day 2026-11-25T22:59:13.883Z
