# CVE-2026-139214: perf: Fix UAF in attach_task_ctx_data()

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.18%, higher than 8% of CVEs (2026-12-01)
- Published: 2026-11-30T13:32:38.695Z
- Modified: 2026-12-01T06:17:39.047Z
- Assigned by: Linux

## Description

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

perf: Fix UAF in attach_task_ctx_data()

struct perf_ctx_data is RCU protected. In attach_task_ctx_data(),
the cmpxchg retry loop runs without holding rcu_read_lock(). If
task->perf_ctx_data already holds a pointer (call it `cd1`), then
try_cmpxchg(&task->perf_ctx_data, &old, cd) fails and loads old = cd1.
A concurrent thread running detach_task_ctx_data() could free cd1
leading to UAF and further memory corruption when cd1 is reclaimed by
another thread.

  CPU 0: attach_task_ctx_data()     CPU 1: detach_task_ctx_data()
  -----------------------------     -----------------------------
  try_cmpxchg(&task->perf_ctx_data,
              &old, cd2)
    -> fails; loads old = cd1

                                    refcount_dec_and_test(&cd1->refcount)
                                    try_cmpxchg(&task->perf_ctx_data,
                                                &cd1, NULL)
                                    perf_free_ctx_data_rcu(cd1)
                                    [ RCU grace period -> kfree(cd1) ]

  refcount_inc_not_zero(&old->refcount)
    -> UAF on freed cd1

Fix this by taking rcu_read_lock across the race window.

(As written by CVE List.)

## Affected

- Linux Linux: from 506e64e710ff9573fd2b86686528762b7901b5e4 before 5d1869d012b475e9165c201a5cc71ad1ac92115a; from 506e64e710ff9573fd2b86686528762b7901b5e4 before b455bcb13502696e588c7a0e60a196851fb87474; from 506e64e710ff9573fd2b86686528762b7901b5e4 before 64ea0e8226ed98d14e0231af1beae10c3d5c043a; 6.15 (not affected: before 6.15; from 6.18.65 up to 6.18.*; from 7.3.6 up to 7.3.*; from 7.4-rc1 up to *)

## References

- <https://git.kernel.org/stable/c/5d1869d012b475e9165c201a5cc71ad1ac92115a>
- <https://git.kernel.org/stable/c/b455bcb13502696e588c7a0e60a196851fb87474>
- <https://git.kernel.org/stable/c/64ea0e8226ed98d14e0231af1beae10c3d5c043a>

## Sources

- CVE List: [CVE-2026-139214](https://www.cve.org/CVERecord?id=CVE-2026-139214), CVE Terms of Use, modified 2026-12-01
- NVD: [CVE-2026-139214](https://nvd.nist.gov/vuln/detail/CVE-2026-139214), Public domain, modified 2026-12-01

---

Page: https://cve.day/CVE-2026-139214 · Whole record: https://cve.day/CVE-2026-139214.json · Rebuilt by cve.day 2026-12-01T06:32:24.092Z
