Skip to contentSkip to conversation

mm-damon-sysfs-schemes-put-damos-dests-dir-after-removing-its-files.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Aug 19, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/sysfs-schemes: put damos dests dir after removing its files
has been removed from the -mm tree. Its filename was
mm-damon-sysfs-schemes-put-damos-dests-dir-after-removing-its-files.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon/sysfs-schemes: put damos dests dir after removing its files
Date: Sat, 16 Aug 2025 09:55:59 -0700

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.

---

 mm/damon/sysfs-schemes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/sysfs-schemes.c renamed from mm/damon/sysfs-schemes.c~mm-damon-sysfs-schemes-put-damos-dests-dir-after-removing-its-files +1 -1
@@ -2158,8 +2158,8 @@ static void damon_sysfs_scheme_rm_dirs(s
 {
 	damon_sysfs_access_pattern_rm_dirs(scheme->access_pattern);
 	kobject_put(&scheme->access_pattern->kobj);
-	kobject_put(&scheme->dests->kobj);
 	damos_sysfs_dests_rm_dirs(scheme->dests);
+	kobject_put(&scheme->dests->kobj);
 	damon_sysfs_quotas_rm_dirs(scheme->quotas);
 	kobject_put(&scheme->quotas->kobj);
 	kobject_put(&scheme->watermarks->kobj);

_

Patches currently in -mm which might be from [email protected] are

mm-zswap-store-page_size-compression-failed-page-as-is.patch