linux/mm/damon
SeongJae Park ba1dd7ac73 mm/damon/sysfs-schemes: put damos dests dir after removing its files
damon_sysfs_scheme_rm_dirs() puts dests directory kobject before removing
its internal files.  Sincee putting the kobject frees its container
struct, and the internal files removal accesses the container,
use-after-free happens.  Fix it by putting the reference _after_ removing
the files.

Link: https://lkml.kernel.org/r/20250816165559.2601-1-sj@kernel.org
Fixes: 2cd0bf85a2 ("mm/damon/sysfs-schemes: implement DAMOS action destinations directory")
Signed-off-by: SeongJae Park <sj@kernel.org>
Reported-by: Alexandre Ghiti <alex@ghiti.fr>
Closes: https://lore.kernel.org/2d39a734-320d-4341-8f8a-4019eec2dbf2@ghiti.fr
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-08-19 16:35:57 -07:00
..
tests mm/damon/core: add cleanup_target() ops callback 2025-07-19 18:59:56 -07:00
Kconfig mm/damon: introduce DAMON_STAT module 2025-07-09 22:41:55 -07:00
Makefile mm/damon: introduce DAMON_STAT module 2025-07-09 22:41:55 -07:00
core.c mm/damon/core: fix damos_commit_filter not changing allow 2025-08-19 16:35:57 -07:00
lru_sort.c mm/damon/lru_sort: use damon_call() repeat mode instead of damon_callback 2025-07-19 18:59:55 -07:00
modules-common.c mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
modules-common.h mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
ops-common.c mm/damon/ops-common: ignore migration request to invalid nodes 2025-07-24 19:12:43 -07:00
ops-common.h mm/damon: move folio filtering from paddr to ops-common 2025-07-19 18:59:50 -07:00
paddr.c mm/damon: move folio filtering from paddr to ops-common 2025-07-19 18:59:50 -07:00
reclaim.c mm/damon/reclaim: use damon_call() repeat mode instead of damon_callback 2025-07-19 18:59:54 -07:00
stat.c mm/damon/stat: use damon_call() repeat mode instead of damon_callback 2025-07-19 18:59:54 -07:00
sysfs-common.c mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
sysfs-common.h mm/damon: s/primitives/code/ on comments 2025-06-05 21:55:41 -07:00
sysfs-schemes.c mm/damon/sysfs-schemes: put damos dests dir after removing its files 2025-08-19 16:35:57 -07:00
sysfs.c mm/damon/sysfs: implement refresh_ms file internal work 2025-07-24 19:12:33 -07:00
vaddr.c mm/damon/vaddr: skip isolating folios already in destination nid 2025-08-02 12:06:09 -07:00