{"id":"CVE-2026-139214","summary":"perf: Fix UAF in attach_task_ctx_data()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nperf: Fix UAF in attach_task_ctx_data()\n\nstruct perf_ctx_data is RCU protected. In attach_task_ctx_data(),\nthe cmpxchg retry loop runs without holding rcu_read_lock(). If\ntask-\u003eperf_ctx_data already holds a pointer (call it `cd1`), then\ntry_cmpxchg(&task-\u003eperf_ctx_data, &old, cd) fails and loads old = cd1.\nA concurrent thread running detach_task_ctx_data() could free cd1\nleading to UAF and further memory corruption when cd1 is reclaimed by\nanother thread.\n\n  CPU 0: attach_task_ctx_data()     CPU 1: detach_task_ctx_data()\n  -----------------------------     -----------------------------\n  try_cmpxchg(&task-\u003eperf_ctx_data,\n              &old, cd2)\n    -\u003e fails; loads old = cd1\n\n                                    refcount_dec_and_test(&cd1-\u003erefcount)\n                                    try_cmpxchg(&task-\u003eperf_ctx_data,\n                                                &cd1, NULL)\n                                    perf_free_ctx_data_rcu(cd1)\n                                    [ RCU grace period -\u003e kfree(cd1) ]\n\n  refcount_inc_not_zero(&old-\u003erefcount)\n    -\u003e UAF on freed cd1\n\nFix this by taking rcu_read_lock across the race window.","modified":"2026-12-01T07:00:38.487534970Z","published":"2026-11-30T13:32:38.695Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139214.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5d1869d012b475e9165c201a5cc71ad1ac92115a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/64ea0e8226ed98d14e0231af1beae10c3d5c043a"},{"type":"WEB","url":"https://git.kernel.org/stable/c/b455bcb13502696e588c7a0e60a196851fb87474"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139214.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139214"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"506e64e710ff9573fd2b86686528762b7901b5e4"},{"fixed":"5d1869d012b475e9165c201a5cc71ad1ac92115a"},{"fixed":"b455bcb13502696e588c7a0e60a196851fb87474"},{"fixed":"64ea0e8226ed98d14e0231af1beae10c3d5c043a"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139214.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.15.0"},{"fixed":"6.18.65"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139214.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}