{"id":"CVE-2025-39877","summary":"mm/damon/sysfs: fix use-after-free in state_show()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/damon/sysfs: fix use-after-free in state_show()\n\nstate_show() reads kdamond-\u003edamon_ctx without holding damon_sysfs_lock. \nThis allows a use-after-free race:\n\nCPU 0                         CPU 1\n-----                         -----\nstate_show()                  damon_sysfs_turn_damon_on()\nctx = kdamond-\u003edamon_ctx;     mutex_lock(&damon_sysfs_lock);\n                              damon_destroy_ctx(kdamond-\u003edamon_ctx);\n                              kdamond-\u003edamon_ctx = NULL;\n                              mutex_unlock(&damon_sysfs_lock);\ndamon_is_running(ctx);        /* ctx is freed */\nmutex_lock(&ctx-\u003ekdamond_lock); /* UAF */\n\n(The race can also occur with damon_sysfs_kdamonds_rm_dirs() and\ndamon_sysfs_kdamond_release(), which free or replace the context under\ndamon_sysfs_lock.)\n\nFix by taking damon_sysfs_lock before dereferencing the context, mirroring\nthe locking used in pid_show().\n\nThe bug has existed since state_show() first accessed kdamond-\u003edamon_ctx.","modified":"2026-05-18T05:56:19.542442555Z","published":"2025-09-23T06:00:48.317Z","related":["SUSE-SU-2025:21074-1","SUSE-SU-2025:21139-1","SUSE-SU-2025:21179-1","openSUSE-SU-2025:20081-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/39xxx/CVE-2025-39877.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/26d29b2ac87a2989071755f9828ebf839b560d4c"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3260a3f0828e06f5f13fac69fb1999a6d60d9cff"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3858c44341ad49dc7544b19cc9f9ecffaa7cc50e"},{"type":"WEB","url":"https://git.kernel.org/stable/c/4e87f461d61959647464a94d11ae15c011be58ce"},{"type":"WEB","url":"https://git.kernel.org/stable/c/60d7a3d2b985a395318faa1d88da6915fad11c19"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/39xxx/CVE-2025-39877.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-39877"},{"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":"a61ea561c87139992fe32afdee48a6f6b85d824a"},{"fixed":"3858c44341ad49dc7544b19cc9f9ecffaa7cc50e"},{"fixed":"60d7a3d2b985a395318faa1d88da6915fad11c19"},{"fixed":"26d29b2ac87a2989071755f9828ebf839b560d4c"},{"fixed":"4e87f461d61959647464a94d11ae15c011be58ce"},{"fixed":"3260a3f0828e06f5f13fac69fb1999a6d60d9cff"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-39877.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.18.0"},{"fixed":"6.1.153"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.107"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.48"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.16.8"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-39877.json"}}],"schema_version":"1.7.5"}