Skip to contentSkip to conversation

CVE-2025-38258: mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 9, 2025

lore
Share & tools
lore
#0 lore raw

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

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

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

mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write

memcg_path_store() assigns a newly allocated memory buffer to filter->memcg_path, without deallocating the previously allocated and assigned memory buffer. As a result, users can leak kernel memory by continuously writing a data to memcg_path DAMOS sysfs file. Fix the leak by deallocating the previously set memory buffer.

The Linux kernel CVE team has assigned CVE-2025-38258 to this issue.

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

	Issue introduced in 6.3 with commit 7ee161f18b5da5170b5d6a51aace49d312099128 and fixed in 6.6.96 with commit 490a43d07f1663d827e802720d30cbc0494e4f81
	Issue introduced in 6.3 with commit 7ee161f18b5da5170b5d6a51aace49d312099128 and fixed in 6.12.36 with commit c5d5b0047b0c0f304608f3824139f7bd34c48413
	Issue introduced in 6.3 with commit 7ee161f18b5da5170b5d6a51aace49d312099128 and fixed in 6.15.5 with commit 4a158ac0538dd5695eeaa00aa0720d711f3e4ef1
	Issue introduced in 6.3 with commit 7ee161f18b5da5170b5d6a51aace49d312099128 and fixed in 6.16-rc4 with commit 4f489fe6afb395dbc79840efa3c05440b760d883

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-2025-38258

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:
mm/damon/sysfs-schemes.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/490a43d07f1663d827e802720d30cbc0494e4f81
	https://git.kernel.org/stable/c/c5d5b0047b0c0f304608f3824139f7bd34c48413
	https://git.kernel.org/stable/c/4a158ac0538dd5695eeaa00aa0720d711f3e4ef1
	https://git.kernel.org/stable/c/4f489fe6afb395dbc79840efa3c05440b760d883