]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm/damon/sysfs: cleanup attrs subdirs on context dir setup failure
authorSeongJae Park <sj@kernel.org>
Thu, 25 Dec 2025 02:30:35 +0000 (18:30 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:21:30 +0000 (11:21 +0100)
commit78b4eb99751ebd37ceade78810bf94de80f7fb3a
tree418653c316f649f98b99ca0c36a8d7f11bfa4ad1
parent9dc11b365e4eba41b5fe5808b7df2916283a5337
mm/damon/sysfs: cleanup attrs subdirs on context dir setup failure

commit 9814cc832b88bd040fc2a1817c2b5469d0f7e862 upstream.

When a context DAMON sysfs directory setup is failed after setup of attrs/
directory, subdirectories of attrs/ directory are not cleaned up.  As a
result, DAMON sysfs interface is nearly broken until the system reboots,
and the memory for the unremoved directory is leaked.

Cleanup the directories under such failures.

Link: https://lkml.kernel.org/r/20251225023043.18579-3-sj@kernel.org
Fixes: c951cd3b8901 ("mm/damon: implement a minimal stub for sysfs-based DAMON interface")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: chongjiapeng <jiapeng.chong@linux.alibaba.com>
Cc: <stable@vger.kernel.org> # 5.18.x
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/damon/sysfs.c