From: Greg Kroah-Hartman Date: Thu, 8 Jan 2026 12:41:49 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v6.1.160~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0de059c53886dc1822e3b3d50a9d2d59ac4606ad;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_merge_two.patch mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_split_at.patch mm-damon-tests-core-kunit-handle-alloc-failures-on-dasmon_test_merge_regions_of.patch mm-damon-tests-core-kunit-handle-allocation-failures-in-damon_test_regions.patch mm-damon-tests-vaddr-kunit-handle-alloc-failures-on-damon_test_split_evenly_succ.patch --- diff --git a/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_merge_two.patch b/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_merge_two.patch new file mode 100644 index 0000000000..b99c1e9b86 --- /dev/null +++ b/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_merge_two.patch @@ -0,0 +1,52 @@ +From 3d443dd29a1db7efa587a4bb0c06a497e13ca9e4 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Sat, 1 Nov 2025 11:20:00 -0700 +Subject: mm/damon/tests/core-kunit: handle alloc failures on damon_test_merge_two() + +From: SeongJae Park + +commit 3d443dd29a1db7efa587a4bb0c06a497e13ca9e4 upstream. + +damon_test_merge_two() 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. + +Link: https://lkml.kernel.org/r/20251101182021.74868-7-sj@kernel.org +Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") +Signed-off-by: SeongJae Park +Cc: Brendan Higgins +Cc: David Gow +Cc: Kefeng Wang +Cc: [5.15+] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/damon/core-test.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/mm/damon/core-test.h ++++ b/mm/damon/core-test.h +@@ -162,10 +162,20 @@ static void damon_test_merge_two(struct + int i; + + t = damon_new_target(); ++ if (!t) ++ kunit_skip(test, "target alloc fail"); + r = damon_new_region(0, 100); ++ if (!r) { ++ damon_free_target(t); ++ kunit_skip(test, "region alloc fail"); ++ } + r->nr_accesses = 10; + damon_add_region(r, t); + r2 = damon_new_region(100, 300); ++ if (!r2) { ++ damon_free_target(t); ++ kunit_skip(test, "second region alloc fail"); ++ } + r2->nr_accesses = 20; + damon_add_region(r2, t); + diff --git a/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_split_at.patch b/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_split_at.patch new file mode 100644 index 0000000000..f9d8719795 --- /dev/null +++ b/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_split_at.patch @@ -0,0 +1,51 @@ +From 5e80d73f22043c59c8ad36452a3253937ed77955 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Sat, 1 Nov 2025 11:19:59 -0700 +Subject: mm/damon/tests/core-kunit: handle alloc failures on damon_test_split_at() + +From: SeongJae Park + +commit 5e80d73f22043c59c8ad36452a3253937ed77955 upstream. + +damon_test_split_at() 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. + +Link: https://lkml.kernel.org/r/20251101182021.74868-6-sj@kernel.org +Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") +Signed-off-by: SeongJae Park +Cc: Brendan Higgins +Cc: David Gow +Cc: Kefeng Wang +Cc: [5.15+] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/damon/core-test.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/mm/damon/core-test.h ++++ b/mm/damon/core-test.h +@@ -129,8 +129,19 @@ static void damon_test_split_at(struct k + struct damon_target *t; + struct damon_region *r; + ++ if (!c) ++ kunit_skip(test, "ctx alloc fail"); + t = damon_new_target(); ++ if (!t) { ++ damon_destroy_ctx(c); ++ kunit_skip(test, "target alloc fail"); ++ } + r = damon_new_region(0, 100); ++ if (!r) { ++ damon_destroy_ctx(c); ++ damon_free_target(t); ++ kunit_skip(test, "region alloc fail"); ++ } + damon_add_region(r, t); + damon_split_region_at(t, r, 25); + KUNIT_EXPECT_EQ(test, r->ar.start, 0ul); diff --git a/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-dasmon_test_merge_regions_of.patch b/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-dasmon_test_merge_regions_of.patch new file mode 100644 index 0000000000..65733cf0bf --- /dev/null +++ b/queue-6.1/mm-damon-tests-core-kunit-handle-alloc-failures-on-dasmon_test_merge_regions_of.patch @@ -0,0 +1,46 @@ +From 0998d2757218771c59d5ca59ccf13d1542a38f17 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Sat, 1 Nov 2025 11:20:01 -0700 +Subject: mm/damon/tests/core-kunit: handle alloc failures on dasmon_test_merge_regions_of() + +From: SeongJae Park + +commit 0998d2757218771c59d5ca59ccf13d1542a38f17 upstream. + +damon_test_merge_regions_of() 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. + +Link: https://lkml.kernel.org/r/20251101182021.74868-8-sj@kernel.org +Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") +Signed-off-by: SeongJae Park +Cc: Brendan Higgins +Cc: David Gow +Cc: Kefeng Wang +Cc: [5.15+] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/damon/core-test.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/mm/damon/core-test.h ++++ b/mm/damon/core-test.h +@@ -210,8 +210,14 @@ static void damon_test_merge_regions_of( + int i; + + t = damon_new_target(); ++ if (!t) ++ kunit_skip(test, "target alloc fail"); + for (i = 0; i < ARRAY_SIZE(sa); i++) { + r = damon_new_region(sa[i], ea[i]); ++ if (!r) { ++ damon_free_target(t); ++ kunit_skip(test, "region alloc fail"); ++ } + r->nr_accesses = nrs[i]; + damon_add_region(r, t); + } diff --git a/queue-6.1/mm-damon-tests-core-kunit-handle-allocation-failures-in-damon_test_regions.patch b/queue-6.1/mm-damon-tests-core-kunit-handle-allocation-failures-in-damon_test_regions.patch new file mode 100644 index 0000000000..f9bf68b84b --- /dev/null +++ b/queue-6.1/mm-damon-tests-core-kunit-handle-allocation-failures-in-damon_test_regions.patch @@ -0,0 +1,49 @@ +From e16fdd4f754048d6e23c56bd8d920b71e41e3777 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Sat, 1 Nov 2025 11:19:56 -0700 +Subject: mm/damon/tests/core-kunit: handle allocation failures in damon_test_regions() + +From: SeongJae Park + +commit e16fdd4f754048d6e23c56bd8d920b71e41e3777 upstream. + +damon_test_regions() 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. + +Link: https://lkml.kernel.org/r/20251101182021.74868-3-sj@kernel.org +Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") +Signed-off-by: SeongJae Park +Cc: Brendan Higgins +Cc: David Gow +Cc: Kefeng Wang +Cc: [5.15+] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/damon/core-test.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/mm/damon/core-test.h ++++ b/mm/damon/core-test.h +@@ -20,11 +20,17 @@ static void damon_test_regions(struct ku + struct damon_target *t; + + r = damon_new_region(1, 2); ++ if (!r) ++ kunit_skip(test, "region alloc fail"); + KUNIT_EXPECT_EQ(test, 1ul, r->ar.start); + KUNIT_EXPECT_EQ(test, 2ul, r->ar.end); + KUNIT_EXPECT_EQ(test, 0u, r->nr_accesses); + + t = damon_new_target(); ++ if (!t) { ++ damon_free_region(r); ++ kunit_skip(test, "target alloc fail"); ++ } + KUNIT_EXPECT_EQ(test, 0u, damon_nr_regions(t)); + + damon_add_region(r, t); diff --git a/queue-6.1/mm-damon-tests-vaddr-kunit-handle-alloc-failures-on-damon_test_split_evenly_succ.patch b/queue-6.1/mm-damon-tests-vaddr-kunit-handle-alloc-failures-on-damon_test_split_evenly_succ.patch new file mode 100644 index 0000000000..dc6d4a79eb --- /dev/null +++ b/queue-6.1/mm-damon-tests-vaddr-kunit-handle-alloc-failures-on-damon_test_split_evenly_succ.patch @@ -0,0 +1,50 @@ +From 0a63a0e7570b9b2631dfb8d836dc572709dce39e Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Sat, 1 Nov 2025 11:20:13 -0700 +Subject: mm/damon/tests/vaddr-kunit: handle alloc failures on damon_test_split_evenly_succ() + +From: SeongJae Park + +commit 0a63a0e7570b9b2631dfb8d836dc572709dce39e upstream. + +damon_test_split_evenly_succ() 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. + +Link: https://lkml.kernel.org/r/20251101182021.74868-20-sj@kernel.org +Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") +Signed-off-by: SeongJae Park +Cc: Brendan Higgins +Cc: David Gow +Cc: Kefeng Wang +Cc: [5.15+] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/damon/vaddr-test.h | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/mm/damon/vaddr-test.h ++++ b/mm/damon/vaddr-test.h +@@ -276,10 +276,17 @@ static void damon_test_split_evenly_succ + unsigned long start, unsigned long end, unsigned int nr_pieces) + { + struct damon_target *t = damon_new_target(); +- struct damon_region *r = damon_new_region(start, end); ++ struct damon_region *r; + unsigned long expected_width = (end - start) / nr_pieces; + unsigned long i = 0; + ++ if (!t) ++ kunit_skip(test, "target alloc fail"); ++ r = damon_new_region(start, end); ++ if (!r) { ++ damon_free_target(t); ++ kunit_skip(test, "region alloc fail"); ++ } + damon_add_region(r, t); + KUNIT_EXPECT_EQ(test, + damon_va_evenly_split_region(t, r, nr_pieces), 0); diff --git a/queue-6.1/series b/queue-6.1/series index 86bf8c36f6..8e3e77d707 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -515,3 +515,8 @@ powerpc-64s-radix-kfence-map-__kfence_pool-at-page-granularity.patch mm-damon-tests-vaddr-kunit-handle-alloc-failures-in-damon_test_split_evenly_fail.patch mm-damon-tests-vaddr-kunit-handle-alloc-failures-on-damon_do_test_apply_three_regions.patch rdma-core-fix-kasan-slab-use-after-free-read-in-ib_register_device-problem.patch +mm-damon-tests-vaddr-kunit-handle-alloc-failures-on-damon_test_split_evenly_succ.patch +mm-damon-tests-core-kunit-handle-allocation-failures-in-damon_test_regions.patch +mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_split_at.patch +mm-damon-tests-core-kunit-handle-alloc-failures-on-dasmon_test_merge_regions_of.patch +mm-damon-tests-core-kunit-handle-alloc-failures-on-damon_test_merge_two.patch