Skip to contentSkip to conversation

mm-damonn-lru_sort-handle-ctx-allocation-failure.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jun 3 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/lru_sort: handle ctx allocation failure
has been removed from the -mm tree. Its filename was
mm-damonn-lru_sort-handle-ctx-allocation-failure.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/lru_sort: handle ctx allocation failure
Date: Thu, 28 May 2026 17:01:03 -0700

DAMON_LRU_SORT allocates the damon_ctx object for its kdamond in its init function. damon_lru_sort_enabled_store() wrongly assumes the allocation will always succeed once tried. If the damon_ctx allocation was failed, therefore, code execution reaches to damon_commit_ctx() while 'ctx' is NULL. As a result, it dereferences the NULL 'ctx' pointer. Avoid the NULL dereference by returning -ENOMEM if 'ctx' is NULL.

Fixes c4a8e662c839 ("mm/damon/lru_sort: use damon_initialized()")
Cc <[email protected]> # 6.18.x

---

 mm/damon/lru_sort.c |    4 ++++
 1 file changed, 4 insertions(+)
mm/damon/lru_sort.c renamed from mm/damon/lru_sort.c~mm-damonn-lru_sort-handle-ctx-allocation-failure +4 -0
@@ -437,6 +437,10 @@ static int damon_lru_sort_enabled_store(
 	if (!damon_initialized())
 		return 0;
 
+	/* damon_modules_new_paddr_ctx_target() in the init function failed. */
+	if (!ctx)
+		return -ENOMEM;
+
 	return damon_lru_sort_turn(enabled);
 }
 

_

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

maintainers-add-testing-abi-documents-for-mm.patch