# CVE-2024-56759: btrfs: fix use-after-free when COWing tree bock and tracing is enabled

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.31% (percentile 17, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-01-06T16:20:39.668Z
- **Modified:** 2026-08-05T11:46:23.511Z

## Who should check

- Anyone running Linux \>= 3083ee2e18b701122a3b841db83448543a87a583, \< ba5120a2fb5f23b4d39d302e181aa5d4e28a90d1; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 526ff5b27f090fb15040471f892cd2c9899ce314; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 66376f1a73cba57fd0af2631d7888605b738e499; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 9a466b8693b9add05de99af00c7bdff8259ecf19; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< c3a403d8ce36f5a809a492581de5ad17843e4701; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 44f52bbe96dfdbe4aca3818a2534520082a07040
- Anyone running Linux 3.4

## Description

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

btrfs: fix use-after-free when COWing tree bock and tracing is enabled

When a COWing a tree block, at btrfs\_cow\_block(), and we have the
tracepoint trace\_btrfs\_cow\_block() enabled and preemption is also enabled
(CONFIG\_PREEMPT=y), we can trigger a use-after-free in the COWed extent
buffer while inside the tracepoint code. This is because in some paths
that call btrfs\_cow\_block(), such as btrfs\_search\_slot(), we are holding
the last reference on the extent buffer @buf so btrfs\_force\_cow\_block()
drops the last reference on the @buf extent buffer when it calls
free\_extent\_buffer\_stale(buf), which schedules the release of the extent
buffer with RCU. This means that if we are on a kernel with preemption,
the current task may be preempted before calling trace\_btrfs\_cow\_block()
and the extent buffer already released by the time trace\_btrfs\_cow\_block()
is called, resulting in a use-after-free.

Fix this by moving the trace\_btrfs\_cow\_block() from btrfs\_cow\_block() to
btrfs\_force\_cow\_block() before the COWed extent buffer is freed.
This also has a side effect of invoking the tracepoint in the tree defrag
code, at defrag.c:btrfs\_realloc\_node(), since btrfs\_force\_cow\_block() is
called there, but this is fine and it was actually missing there.

## Affected and fixed versions

- Linux: \>= 3083ee2e18b701122a3b841db83448543a87a583, \< ba5120a2fb5f23b4d39d302e181aa5d4e28a90d1; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 526ff5b27f090fb15040471f892cd2c9899ce314; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 66376f1a73cba57fd0af2631d7888605b738e499; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 9a466b8693b9add05de99af00c7bdff8259ecf19; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< c3a403d8ce36f5a809a492581de5ad17843e4701; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 44f52bbe96dfdbe4aca3818a2534520082a07040 (cvelist)
- Linux: 3.4 (cvelist)

## Mitigation

- Upgrade Linux to 44f52bbe96dfdbe4aca3818a2534520082a07040 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-56759. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-56759.md
Affected: Linux >= 3083ee2e18b701122a3b841db83448543a87a583, < ba5120a2fb5f23b4d39d302e181aa5d4e28a90d1; >= 3083ee2e18b701122a3b841db83448543a87a583, < 526ff5b27f090fb15040471f892cd2c9899ce314; >= 3083ee2e18b701122a3b841db83448543a87a583, < 66376f1a73cba57fd0af2631d7888605b738e499; >= 3083ee2e18b701122a3b841…
Fixed in: Linux 526ff5b27f090fb15040471f892cd2c9899ce314, Linux 66376f1a73cba57fd0af2631d7888605b738e499, Linux 9a466b8693b9add05de99af00c7bdff8259ecf19, Linux 44f52bbe96dfdbe4aca3818a2534520082a07040

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-56759 being exploited?

There is no confirmed exploitation: CVE-2024-56759 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.31% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-56759?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-56759?

Linux \>= 3083ee2e18b701122a3b841db83448543a87a583, \< ba5120a2fb5f23b4d39d302e181aa5d4e28a90d1; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 526ff5b27f090fb15040471f892cd2c9899ce314; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 66376f1a73cba57fd0af2631d7888605b738e499; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 9a466b8693b9add05de99af00c7bdff8259ecf19; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< c3a403d8ce36f5a809a492581de5ad17843e4701; \>= 3083ee2e18b701122a3b841db83448543a87a583, \< 44f52bbe96dfdbe4aca3818a2534520082a07040; Linux 3.4.

### Is there a fix for CVE-2024-56759?

Yes. Fixed in Linux 526ff5b27f090fb15040471f892cd2c9899ce314, Linux 66376f1a73cba57fd0af2631d7888605b738e499, Linux 9a466b8693b9add05de99af00c7bdff8259ecf19, Linux 44f52bbe96dfdbe4aca3818a2534520082a07040. Upgrade Linux to 44f52bbe96dfdbe4aca3818a2534520082a07040 or later.

### How do I check if I'm affected by CVE-2024-56759?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/c3a403d8ce36f5a809a492581de5ad17843e4701>
- patch: <https://git.kernel.org/stable/c/44f52bbe96dfdbe4aca3818a2534520082a07040>
- other: <https://git.kernel.org/stable/c/ba5120a2fb5f23b4d39d302e181aa5d4e28a90d1>
- other: <https://git.kernel.org/stable/c/526ff5b27f090fb15040471f892cd2c9899ce314>
- other: <https://git.kernel.org/stable/c/66376f1a73cba57fd0af2631d7888605b738e499>
- other: <https://git.kernel.org/stable/c/9a466b8693b9add05de99af00c7bdff8259ecf19>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-56759>

HTML: <https://flawdb.com/CVE-2024-56759> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-56759>
