Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm/damon/tests/core-kunit: handle alloc failres in" failed to apply to 6.6-stable tree

PATCH New [email protected] 3 participants 3 messages Jan 5 – Jan 6

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 28ab2265e9422ccd81e4beafc0ace90f78de04c4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026010551-reawake-rimless-688e@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 28ab2265e9422ccd81e4beafc0ace90f78de04c4 Mon Sep 17 00:00:00 2001
From: SeongJae Park <[email protected]>
Date: Sat, 1 Nov 2025 11:20:07 -0700
Subject: [PATCH] mm/damon/tests/core-kunit: handle alloc failres in
damon_test_new_filter()

damon_test_new_filter() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.

Fixes 2a158e956b98 ("mm/damon/core-test: add a test for damos_new_filter()")
Cc Brendan Higgins <[email protected]>
Cc David Gow <[email protected]>
Cc Kefeng Wang <[email protected]>
Cc <[email protected]> [6.6+]
mm/damon/tests/core-kunit.h +2 -0
index b9bd69a57e62..03c7ac31db5c 100644
@@ -505,6 +505,8 @@ static void damos_test_new_filter(struct kunit *test)
 	struct damos_filter *filter;
 
 	filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true, false);
+	if (!filter)
+		kunit_skip(test, "filter alloc fail");
 	KUNIT_EXPECT_EQ(test, filter->type, DAMOS_FILTER_TYPE_ANON);
 	KUNIT_EXPECT_EQ(test, filter->matching, true);
 	KUNIT_EXPECT_PTR_EQ(test, filter->list.prev, &filter->list);
maintainer
#1 lore raw

PATCH 1/1 mm/damon/tests/core-kunit: handle alloc failres in damon_test_new_filter()

damon_test_new_filter() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.

Fixes 2a158e956b98 ("mm/damon/core-test: add a test for damos_new_filter()")
Cc Brendan Higgins <[email protected]>
Cc David Gow <[email protected]>
Cc Kefeng Wang <[email protected]>
Cc <[email protected]> [6.6+]
(cherry picked from commit 28ab2265e9422ccd81e4beafc0ace90f78de04c4)
---
 mm/damon/core-test.h | 2 ++
 1 file changed, 2 insertions(+)
mm/damon/core-test.h +2 -0
index 6cc8b245586d..2bd14d2bfdbb 100644
@@ -346,6 +346,8 @@ static void damos_test_new_filter(struct kunit *test)
 	struct damos_filter *filter;
 
 	filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true);
+	if (!filter)
+		kunit_skip(test, "filter alloc fail");
 	KUNIT_EXPECT_EQ(test, filter->type, DAMOS_FILTER_TYPE_ANON);
 	KUNIT_EXPECT_EQ(test, filter->matching, true);
 	KUNIT_EXPECT_PTR_EQ(test, filter->list.prev, &filter->list);
Signature · 1 line
2.47.3
maintainer
#2 lore raw

PATCH 1/1 mm/damon/tests/core-kunit: handle alloc failres in damon_test_new_filter()

In reply to [email protected]

From: SeongJae Park <[email protected]>

[ Upstream commit 28ab2265e9422ccd81e4beafc0ace90f78de04c4 ]

damon_test_new_filter() is assuming all dynamic memory allocation in it will succeed. Those are indeed likely in the real use cases since those allocations are too small to fail, but theoretically those could fail. In the case, inappropriate memory access can happen. Fix it by appropriately cleanup pre-allocated memory and skip the execution of the remaining tests in the failure cases.

Fixes 2a158e956b98 ("mm/damon/core-test: add a test for damos_new_filter()")
Cc Brendan Higgins <[email protected]>
Cc David Gow <[email protected]>
Cc Kefeng Wang <[email protected]>
Cc <[email protected]> [6.6+]
[ adapted 3-argument damos_new_filter() call to 2-argument version ]
---
 mm/damon/core-test.h | 2 ++
 1 file changed, 2 insertions(+)
mm/damon/core-test.h +2 -0
index 6cc8b245586d..2bd14d2bfdbb 100644
@@ -346,6 +346,8 @@ static void damos_test_new_filter(struct kunit *test)
 	struct damos_filter *filter;
 
 	filter = damos_new_filter(DAMOS_FILTER_TYPE_ANON, true);
+	if (!filter)
+		kunit_skip(test, "filter alloc fail");
 	KUNIT_EXPECT_EQ(test, filter->type, DAMOS_FILTER_TYPE_ANON);
 	KUNIT_EXPECT_EQ(test, filter->matching, true);
 	KUNIT_EXPECT_PTR_EQ(test, filter->list.prev, &filter->list);
Signature · 1 line
2.51.0