]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm/damon/sysfs-scheme: cleanup access_pattern subdirs on scheme dir setup failure
authorSeongJae Park <sj@kernel.org>
Thu, 25 Dec 2025 02:30:37 +0000 (18:30 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:50 +0000 (11:18 +0100)
commit16236b0b4a08fa3e326cf1373ef789dabdc2e30d
tree616dd6c9c7eadc5c7b34e82a9e23d62cccfc1514
parentb831557a0d20d912862fffc116c6b9e12f054fbc
mm/damon/sysfs-scheme: cleanup access_pattern subdirs on scheme dir setup failure

commit 392b3d9d595f34877dd745b470c711e8ebcd225c upstream.

When a DAMOS-scheme DAMON sysfs directory setup fails after setup of
access_pattern/ directory, subdirectories of access_pattern/ 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-5-sj@kernel.org
Fixes: 9bbb820a5bd5 ("mm/damon/sysfs: support DAMOS quotas")
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: SeongJae Park <sj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/damon/sysfs-schemes.c