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

From: SeongJae Park

Date: Wed Jun 17 2026 - 10:51:18 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: SeongJae 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 36a0e82601697..ffbc99411f53b 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1183,6 +1183,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