[PATCH 10/11] mm/damon/sysfs: kobject_del() probe dirs in probes_addd_dir error path

From: SJ Park

Date: Sun Jun 28 2026 - 18:05:10 EST


On CONFIG_DEBUG_KOBJECT_RELEASE enabled kernel, lack of kobject_del()
could cause directories creation failures due to the name conflicts.
Fix the issue for data attribute probe filter directories in the error
handling path of damon_sysfs_probes_add_dirs() by adding a kobject_del()
call.

Fixes: af7cb41af9a9 ("mm/damon/sysfs: implement filters directory")
Signed-off-by: SJ Park <sj@xxxxxxxxxx>
---
mm/damon/sysfs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 0ccdc71275d52..e3526a263e205 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1181,6 +1181,7 @@ static int damon_sysfs_probes_add_dirs(

err = damon_sysfs_probe_add_dirs(probe);
if (err) {
+ kobject_del(&probe->kobj);
kobject_put(&probe->kobj);
damon_sysfs_probes_rm_dirs(probes);
return err;
--
2.47.3