5.5medium
of: unittest: Fix memory leak in unittest_data_add()
- Severity
- 5.5medium CVSS:3.1 by NVD
- Exploit likelihood
- 0.17% (higher than 7% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- 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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| 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 * | CVE List |
| linux linux_kernel | from 3.18 before 6.18.6, 6.19 | NVD |
Classification
What each source says
CVE List
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.
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: of: unittest: Corrección de fuga de memoria en unittest_data_add() En unittest_data_add(), si of_resolve_phandles() falla, el unittest_data asignado no se libera, lo que provoca una fuga de memoria. Esto se soluciona usando un ayudante de limpieza basado en el ámbito __free(kfree) para la limpieza automática de recursos. Esto asegura que unittest_data se libera automáticamente cuando sale del ámbito en rutas de error. Para la ruta de éxito, use retain_and_null_ptr() para transferir la propiedad de la memoria al árbol de dispositivos y evitar la doble liberación.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-23137 changed 2026-10-30 | CVE Terms of Use |
| NVD | CVE-2026-23137 changed 2026-10-30 | Public domain |