Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E2A15427F4 for ; Tue, 8 Sep 2026 12:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788872200; cv=none; b=VUpNur/pX+RDnNTvzeJQLzP+AsbLn7eu0Z6+yWu2U0xX0O8gskRpXjOBVb+uSugx//bW9uWFQyZU2AlAoqcQkaysclUgg87x/m6ujghgEKCCd62eKSD4/KdzCulonbesAFNAZqQiIEtPuOW3h2SolG4m+Z/Vlv8wG3ZSTkxg4oo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788872200; c=relaxed/simple; bh=XQdTVOkm7creUyh2f5HkwYXyYlCO4+JmujxSYpJHGiQ=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=pf5S3aVN99eybGnUK4V3HLzTbtu3bTgz4ql2PXOki5WPIsItK+RjF9bD6U9arqARtr592CDFCi5dYSZMjk7jSSXCuhi9rFNCSOwBLcyNTbOlqX1szDLv9RYuBhA7sDUqh3PsOtY/osor42N3XN3qYKYYVZKuKVuub9vuoXz/XVo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lSLNeJ0u; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lSLNeJ0u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90A141F00A3A; Tue, 8 Sep 2026 12:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788872199; bh=l4b3P7JvhTi8FEu6XupbbJDd/yVwCYAXssW06yzk8eI=; h=Subject:To:Cc:From:Date; b=lSLNeJ0u6KPCAu8b1npQwXaOZzGk2j6t4K8+zSQTJM1Myl+do+5iED9ImF2KSmGj4 hz0ju4lODFPHJzqI3pfwikWCmA1JH6sZS5mmesq8EhsBbHPO1O/vb/PG5cw8eXKlRO ZXH6OesTpapVPPNHMd0rlEGHQRJbT/3DxJ3U2kbY= Subject: FAILED: patch "[PATCH] mm/damon/core-kunit: check region count before testing in" failed to apply to 6.1-stable tree To: sj@kernel.org,akpm@linux-foundation.org,brendan.higgins@linux.dev,stable@vger.kernel.org Cc: From: Date: Tue, 08 Sep 2026 14:51:20 +0200 Message-ID: <2026090820-envoy-endanger-c99b@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-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 . 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.1.y git checkout FETCH_HEAD git cherry-pick -x 9b18ef3c3aa1ce24176e340061caf15fa2742564 # git commit -s git send-email --to '' --in-reply-to '2026090820-envoy-endanger-c99b@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 9b18ef3c3aa1ce24176e340061caf15fa2742564 Mon Sep 17 00:00:00 2001 From: SJ Park Date: Fri, 17 Jul 2026 17:14:36 -0700 Subject: [PATCH] mm/damon/core-kunit: check region count before testing in split_at() damon_test_split_at() test next region that is assumed to be created by damon_split_region_at() invocation. But the split might fail. In this case, the succeeding test may dereference invalid pointers returned by damon_next_region(). The invalid pointer may not cause a really bad user impact, because of the implementation detail. It would only read wrong contents in the belonging damon_target struct. Depending on the future change of the offset from the link header to the accessing field, this could also be really dangerous, though. Still, the realistic user impact would be limited. It would affect only test run setups. Fix it by testing if the number of regions was also changed as expected and exit early for the failure. The issue was discovered [1] by Sashiko. Link: https://lore.kernel.org/20260718001442.87129-3-sj@kernel.org Link: https://lore.kernel.org/20260714142352.100478-1-sj@kernel.org [1] Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") Signed-off-by: SJ Park Cc: Brendan Higgins Cc: # 5.15.x Signed-off-by: Andrew Morton diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index eba643762132..322a295ac2ce 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -155,6 +155,10 @@ static void damon_test_split_at(struct kunit *test) r->age = 10; damon_add_region(r, t); damon_split_region_at(t, r, 25); + KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 2); + if (damon_nr_regions(t) != 2) + goto out; + KUNIT_EXPECT_EQ(test, r->ar.start, 0ul); KUNIT_EXPECT_EQ(test, r->ar.end, 25ul); @@ -166,6 +170,7 @@ static void damon_test_split_at(struct kunit *test) KUNIT_EXPECT_EQ(test, r->last_nr_accesses, r_new->last_nr_accesses); KUNIT_EXPECT_EQ(test, r->age, r_new->age); +out: damon_free_target(t); }