Skip to contentSkip to conversation

CVE-2026-31457: mm/damon/sysfs: check contexts->nr in repeat_call_fn

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Apr 22

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

mm/damon/sysfs: check contexts->nr in repeat_call_fn

damon_sysfs_repeat_call_fn() calls damon_sysfs_upd_tuned_intervals(), damon_sysfs_upd_schemes_stats(), and damon_sysfs_upd_schemes_effective_quotas() without checking contexts->nr. If nr_contexts is set to 0 via sysfs while DAMON is running, these functions dereference contexts_arr[0] and cause a NULL pointer dereference. Add the missing check.

For example, the issue can be reproduced using DAMON sysfs interface and DAMON user-space tool (damo) [1] like below.

    $ sudo damo start --refresh_interval 1s
    $ echo 0 | sudo tee \
            /sys/kernel/mm/damon/admin/kdamonds/0/contexts/nr_contexts

The Linux kernel CVE team has assigned CVE-2026-31457 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.17 with commit d809a7c64ba8229286b333c0cba03b1cdfb50238 and fixed in 6.18.21 with commit 3527e9fdc38570cea0f6ddb7a2c9303d4044b217
	Issue introduced in 6.17 with commit d809a7c64ba8229286b333c0cba03b1cdfb50238 and fixed in 6.19.11 with commit 652cd0641a763dd0e846b0d12814977fadb2b7d8
	Issue introduced in 6.17 with commit d809a7c64ba8229286b333c0cba03b1cdfb50238 and fixed in 7.0 with commit 6557004a8b59c7701e695f02be03c7e20ed1cc15

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-31457

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
mm/damon/sysfs.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/3527e9fdc38570cea0f6ddb7a2c9303d4044b217
	https://git.kernel.org/stable/c/652cd0641a763dd0e846b0d12814977fadb2b7d8
	https://git.kernel.org/stable/c/6557004a8b59c7701e695f02be03c7e20ed1cc15