{"id":"CVE-2026-31458","summary":"mm/damon/sysfs: check contexts-\u003enr before accessing contexts_arr[0]","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/damon/sysfs: check contexts-\u003enr before accessing contexts_arr[0]\n\nMultiple sysfs command paths dereference contexts_arr[0] without first\nverifying that kdamond-\u003econtexts-\u003enr == 1.  A user can set nr_contexts to\n0 via sysfs while DAMON is running, causing NULL pointer dereferences.\n\nIn more detail, the issue can be triggered by privileged users like\nbelow.\n\nFirst, start DAMON and make contexts directory empty\n(kdamond-\u003econtexts-\u003enr == 0).\n\n    # damo start\n    # cd /sys/kernel/mm/damon/admin/kdamonds/0\n    # echo 0 \u003e contexts/nr_contexts\n\nThen, each of below commands will cause the NULL pointer dereference.\n\n    # echo update_schemes_stats \u003e state\n    # echo update_schemes_tried_regions \u003e state\n    # echo update_schemes_tried_bytes \u003e state\n    # echo update_schemes_effective_quotas \u003e state\n    # echo update_tuned_intervals \u003e state\n\nGuard all commands (except OFF) at the entry point of\ndamon_sysfs_handle_cmd().","modified":"2026-07-08T08:00:03.609907764Z","published":"2026-04-22T13:53:50.883Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31458.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/1bfe9fb5ed2667fb075682408b776b5273162615"},{"type":"WEB","url":"https://git.kernel.org/stable/c/1e8da792672481d603fa7cd0d815577220a3ee27"},{"type":"WEB","url":"https://git.kernel.org/stable/c/708033c231bd782858f4ddbb46ee874a5a5fbdab"},{"type":"WEB","url":"https://git.kernel.org/stable/c/aba546061341b56e9ffb37e1eb661a3628b6ec12"},{"type":"WEB","url":"https://git.kernel.org/stable/c/bbe03ad3fb9e714191757ca7b41582f930be7be2"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/31xxx/CVE-2026-31458.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31458"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"0ac32b8affb5a384253dbb8339bd2d0e91add0b7"},{"fixed":"aba546061341b56e9ffb37e1eb661a3628b6ec12"},{"fixed":"1e8da792672481d603fa7cd0d815577220a3ee27"},{"fixed":"708033c231bd782858f4ddbb46ee874a5a5fbdab"},{"fixed":"bbe03ad3fb9e714191757ca7b41582f930be7be2"},{"fixed":"1bfe9fb5ed2667fb075682408b776b5273162615"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-31458.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.18.0"},{"fixed":"6.6.131"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.80"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.21"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"6.19.11"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-31458.json"}}],"schema_version":"1.7.5"}