<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/mm/damon, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-04-11T12:16:33+00:00</updated>
<entry>
<title>mm/damon/sysfs: check contexts-&gt;nr before accessing contexts_arr[0]</title>
<updated>2026-04-11T12:16:33+00:00</updated>
<author>
<name>Josh Law</name>
<email>objecting@objecting.org</email>
</author>
<published>2026-03-31T05:29:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dee11efae9e7911a14fee6568ce1eab5fa71f255'/>
<id>urn:sha1:dee11efae9e7911a14fee6568ce1eab5fa71f255</id>
<content type='text'>
Multiple sysfs command paths dereference contexts_arr[0] without first
verifying that kdamond-&gt;contexts-&gt;nr == 1.  A user can set nr_contexts to
0 via sysfs while DAMON is running, causing NULL pointer dereferences.

In more detail, the issue can be triggered by privileged users like
below.

First, start DAMON and make contexts directory empty
(kdamond-&gt;contexts-&gt;nr == 0).

    # damo start
    # cd /sys/kernel/mm/damon/admin/kdamonds/0
    # echo 0 &gt; contexts/nr_contexts

Then, each of below commands will cause the NULL pointer dereference.

    # echo update_schemes_stats &gt; state
    # echo update_schemes_tried_regions &gt; state
    # echo update_schemes_tried_bytes &gt; state
    # echo update_schemes_effective_quotas &gt; state
    # echo update_tuned_intervals &gt; state

Guard all commands (except OFF) at the entry point of
damon_sysfs_handle_cmd().

(cherry picked from commit 1bfe9fb5ed2667fb075682408b776b5273162615)

Link: https://lkml.kernel.org/r/20260321175427.86000-3-sj@kernel.org
Fixes: 0ac32b8affb5 ("mm/damon/sysfs: support DAMOS stats")
Signed-off-by: Josh Law &lt;objecting@objecting.org&gt;
Reviewed-by: SeongJae Park &lt;sj@kernel.org&gt;
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[5.18+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/sysfs-scheme: cleanup access_pattern subdirs on scheme dir setup failure</title>
<updated>2026-02-06T15:44:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-12-25T02:30:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ae8ac0066b48ed957bdcab58f0d3543549c57a29'/>
<id>urn:sha1:ae8ac0066b48ed957bdcab58f0d3543549c57a29</id>
<content type='text'>
commit 392b3d9d595f34877dd745b470c711e8ebcd225c upstream.

When a DAMOS-scheme DAMON sysfs directory setup fails after setup of
access_pattern/ directory, subdirectories of access_pattern/ directory are
not cleaned up.  As a result, DAMON sysfs interface is nearly broken until
the system reboots, and the memory for the unremoved directory is leaked.

Cleanup the directories under such failures.

Link: https://lkml.kernel.org/r/20251225023043.18579-5-sj@kernel.org
Fixes: 9bbb820a5bd5 ("mm/damon/sysfs: support DAMOS quotas")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: chongjiapeng &lt;jiapeng.chong@linux.alibaba.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 5.18.x
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/sysfs-scheme: cleanup quotas subdirs on scheme dir setup failure</title>
<updated>2026-02-06T15:44:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-12-25T02:30:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=abea0b57b0d338add45d742851a6a8f7b4c3e0e5'/>
<id>urn:sha1:abea0b57b0d338add45d742851a6a8f7b4c3e0e5</id>
<content type='text'>
commit dc7e1d75fd8c505096d0cddeca9e2efb2b55aaf9 upstream.

When a DAMOS-scheme DAMON sysfs directory setup fails after setup of
quotas/ directory, subdirectories of quotas/ directory are not cleaned up.
As a result, DAMON sysfs interface is nearly broken until the system
reboots, and the memory for the unremoved directory is leaked.

Cleanup the directories under such failures.

Link: https://lkml.kernel.org/r/20251225023043.18579-4-sj@kernel.org
Fixes: 1b32234ab087 ("mm/damon/sysfs: support DAMOS watermarks")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: chongjiapeng &lt;jiapeng.chong@linux.alibaba.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 5.18.x
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/sysfs: cleanup attrs subdirs on context dir setup failure</title>
<updated>2026-02-06T15:44:00+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-12-25T02:30:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=db7dfe78fc81bdd2b532d77f340fe453f2360426'/>
<id>urn:sha1:db7dfe78fc81bdd2b532d77f340fe453f2360426</id>
<content type='text'>
commit 9814cc832b88bd040fc2a1817c2b5469d0f7e862 upstream.

When a context DAMON sysfs directory setup is failed after setup of attrs/
directory, subdirectories of attrs/ directory are not cleaned up.  As a
result, DAMON sysfs interface is nearly broken until the system reboots,
and the memory for the unremoved directory is leaked.

Cleanup the directories under such failures.

Link: https://lkml.kernel.org/r/20251225023043.18579-3-sj@kernel.org
Fixes: c951cd3b8901 ("mm/damon: implement a minimal stub for sysfs-based DAMON interface")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: chongjiapeng &lt;jiapeng.chong@linux.alibaba.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 5.18.x
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/tests/core-kunit: handle alloc failures in damon_test_set_regions()</title>
<updated>2026-01-11T14:19:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-11-01T18:20:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=174b077a7f34e9d6d890d7b6d83a5e305161a231'/>
<id>urn:sha1:174b077a7f34e9d6d890d7b6d83a5e305161a231</id>
<content type='text'>
commit 74d5969995d129fd59dd93b9c7daa6669cb6810f upstream.

damon_test_set_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-11-sj@kernel.org
Fixes: 62f409560eb2 ("mm/damon/core-test: test damon_set_regions")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: Brendan Higgins &lt;brendan.higgins@linux.dev&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[6.1+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/tests/core-kunit: handle memory alloc failure from damon_test_aggregate()</title>
<updated>2026-01-11T14:19:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-11-01T18:19:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9aadb4fce0d7905e36455683fbc9aedee48ba938'/>
<id>urn:sha1:9aadb4fce0d7905e36455683fbc9aedee48ba938</id>
<content type='text'>
commit f79f2fc44ebd0ed655239046be3e80e8804b5545 upstream.

damon_test_aggregate() 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-5-sj@kernel.org
Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: Brendan Higgins &lt;brendan.higgins@linux.dev&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[5.15+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/tests/core-kunit: handle alloc failures on damon_test_split_regions_of()</title>
<updated>2026-01-11T14:19:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-11-01T18:20:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8ba3c978aea81b936512406b1494c95d3115c371'/>
<id>urn:sha1:8ba3c978aea81b936512406b1494c95d3115c371</id>
<content type='text'>
commit eded254cb69044bd4abde87394ea44909708d7c0 upstream.

damon_test_split_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-9-sj@kernel.org
Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: Brendan Higgins &lt;brendan.higgins@linux.dev&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[5.15+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/tests/core-kunit: handle memory failure from damon_test_target()</title>
<updated>2026-01-11T14:19:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-11-01T18:19:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0373d9c5e474de2c36a5518474d136ea8e20b197'/>
<id>urn:sha1:0373d9c5e474de2c36a5518474d136ea8e20b197</id>
<content type='text'>
commit fafe953de2c661907c94055a2497c6b8dbfd26f3 upstream.

damon_test_target() 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-4-sj@kernel.org
Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests")
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: Brendan Higgins &lt;brendan.higgins@linux.dev&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[5.15+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/tests/core-kunit: handle alloc failures on damon_test_merge_two()</title>
<updated>2026-01-11T14:19:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-11-01T18:20:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=aadc66afe730a0b3f1706e10c566c3218ba8bd51'/>
<id>urn:sha1:aadc66afe730a0b3f1706e10c566c3218ba8bd51</id>
<content type='text'>
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 &lt;sj@kernel.org&gt;
Cc: Brendan Higgins &lt;brendan.higgins@linux.dev&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[5.15+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm/damon/tests/core-kunit: handle alloc failures on dasmon_test_merge_regions_of()</title>
<updated>2026-01-11T14:19:14+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2025-11-01T18:20:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c3f31f4d00fd06d5ce58ba8085009f656906ab7f'/>
<id>urn:sha1:c3f31f4d00fd06d5ce58ba8085009f656906ab7f</id>
<content type='text'>
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 &lt;sj@kernel.org&gt;
Cc: Brendan Higgins &lt;brendan.higgins@linux.dev&gt;
Cc: David Gow &lt;davidgow@google.com&gt;
Cc: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;	[5.15+]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
