deepin-kernel/mm/damon
SeongJae Park 9edebef382 mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write
commit 4f489fe6afb395dbc79840efa3c05440b760d883 upstream.

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.

Link: https://lkml.kernel.org/r/20250619183608.6647-2-sj@kernel.org
Fixes: 7ee161f18b ("mm/damon/sysfs-schemes: implement filter directory")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>		[6.3.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 490a43d07f1663d827e802720d30cbc0494e4f81)
2025-07-09 09:49:59 +08:00
..
Kconfig mm/damon/Kconfig: add DAMON debugfs interface deprecation notice 2023-02-13 15:54:32 -08:00
Makefile mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
core-test.h mm/damon/core-test: add a unit test for __damos_filter_out() 2023-08-21 13:37:35 -07:00
core.c mm/damon/core: copy nr_accesses when splitting region 2024-12-10 20:43:58 +08:00
dbgfs-test.h mm/damon/dbgfs-test: fix is_target_id() change 2022-03-22 15:57:12 -07:00
dbgfs.c mm/damon/core: implement scheme-specific apply interval 2024-12-10 20:43:56 +08:00
lru_sort.c mm/damon/core: implement scheme-specific apply interval 2024-12-10 20:43:56 +08:00
modules-common.c mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
modules-common.h mm/damon/modules: deduplicate init steps for DAMON context setup 2022-11-30 15:01:26 -08:00
ops-common.c mm/damon/ops-common: avoid divide-by-zero during region hotness calculation 2023-11-28 17:19:58 +00:00
ops-common.h mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-06-09 16:25:55 -07:00
paddr.c damon: use pmdp_get instead of drectly dereferencing pmd 2023-08-21 13:37:30 -07:00
reclaim.c mm/damon/core: implement scheme-specific apply interval 2024-12-10 20:43:56 +08:00
sysfs-common.c mm/damon/sysfs: make kobj_type structures constant 2023-02-09 16:51:45 -08:00
sysfs-common.h mm/damon/sysfs: implement a command for updating only schemes tried total bytes 2023-08-21 13:37:34 -07:00
sysfs-schemes.c mm/damon/sysfs-schemes: free old damon_sysfs_scheme_filter->memcg_path on write 2025-07-09 09:49:59 +08:00
sysfs.c mm/damon/sysfs: eliminate potential uninitialized variable warning 2023-12-13 18:45:11 +01:00
vaddr-test.h mm/damon/vaddr: fix issue in damon_va_evenly_split_region() 2024-12-16 00:22:41 +08:00
vaddr.c mm/damon/vaddr: fix issue in damon_va_evenly_split_region() 2024-12-16 00:22:41 +08:00