# CVE-2024-58089: btrfs: fix double accounting race when btrfs\_run\_delalloc\_range() failed

> 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.32% (percentile 17, 2026-11-26)
- **CWE:** CWE-770
- **Published:** 2025-03-12T09:41:59.709Z
- **Modified:** 2026-08-05T11:47:39.479Z

## Who should check

- Anyone running Linux \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 21333148b5c9e52f41fafcedec3810b56a5e0e40; \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 0283ee1912c8e243c931f4ee5b3672e954fe0384; \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 72dad8e377afa50435940adfb697e070d3556670; eb124aaa2e85e9dceac37be5b7166a04b9b26735; \>= 4.19.73, \< 4.20
- Anyone running Linux 5.0

## Description

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

btrfs: fix double accounting race when btrfs\_run\_delalloc\_range() failed

\[BUG\]
When running btrfs with block size (4K) smaller than page size (64K,
aarch64), there is a very high chance to crash the kernel at
generic/750, with the following messages:
(before the call traces, there are 3 extra debug messages added)

  BTRFS warning (device dm-3): read-write for sector size 4096 with page size 65536 is experimental
  BTRFS info (device dm-3): checking UUID tree
  hrtimer: interrupt took 5451385 ns
  BTRFS error (device dm-3): cow\_file\_range failed, root=4957 inode=257 start=1605632 len=69632: -28
  BTRFS error (device dm-3): run\_delalloc\_nocow failed, root=4957 inode=257 start=1605632 len=69632: -28
  BTRFS error (device dm-3): failed to run delalloc range, root=4957 ino=257 folio=1572864 submit\_bitmap=8-15 start=1605632 len=69632: -28
  ------------\[ cut here \]------------
  WARNING: CPU: 2 PID: 3020984 at ordered-data.c:360 can\_finish\_ordered\_extent+0x370/0x3b8 \[btrfs\]
  CPU: 2 UID: 0 PID: 3020984 Comm: kworker/u24:1 Tainted: G           OE      6.13.0-rc1-custom+ \#89
  Tainted: \[O\]=OOT\_MODULE, \[E\]=UNSIGNED\_MODULE
  Hardware name: QEMU KVM Virtual Machine, BIOS unknown 2/2/2022
  Workqueue: events\_unbound btrfs\_async\_reclaim\_data\_space \[btrfs\]
  pc : can\_finish\_ordered\_extent+0x370/0x3b8 \[btrfs\]
  lr : can\_finish\_ordered\_extent+0x1ec/0x3b8 \[btrfs\]
  Call trace:
   can\_finish\_ordered\_extent+0x370/0x3b8 \[btrfs\] (P)
   can\_finish\_ordered\_extent+0x1ec/0x3b8 \[btrfs\] (L)
   btrfs\_mark\_ordered\_io\_finished+0x130/0x2b8 \[btrfs\]
   extent\_writepage+0x10c/0x3b8 \[btrfs\]
   extent\_write\_cache\_pages+0x21c/0x4e8 \[btrfs\]
   btrfs\_writepages+0x94/0x160 \[btrfs\]
   do\_writepages+0x74/0x190
   filemap\_fdatawrite\_wbc+0x74/0xa0
   start\_delalloc\_inodes+0x17c/0x3b0 \[btrfs\]
   btrfs\_start\_delalloc\_roots+0x17c/0x288 \[btrfs\]
   shrink\_delalloc+0x11c/0x280 \[btrfs\]
   flush\_space+0x288/0x328 \[btrfs\]
   btrfs\_async\_reclaim\_data\_space+0x180/0x228 \[btrfs\]
   process\_one\_work+0x228/0x680
   worker\_thread+0x1bc/0x360
   kthread+0x100/0x118
   ret\_from\_fork+0x10/0x20
  ---\[ end trace 0000000000000000 \]---
  BTRFS critical (device dm-3): bad ordered extent accounting, root=4957 ino=257 OE offset=1605632 OE len=16384 to\_dec=16384 left=0
  BTRFS critical (device dm-3): bad ordered extent accounting, root=4957 ino=257 OE offset=1622016 OE len=12288 to\_dec=12288 left=0
  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
  BTRFS critical (device dm-3): bad ordered extent accounting, root=4957 ino=257 OE offset=1634304 OE len=8192 to\_dec=4096 left=0
  CPU: 1 UID: 0 PID: 3286940 Comm: kworker/u24:3 Tainted: G        W  OE      6.13.0-rc1-custom+ \#89
  Hardware name: QEMU KVM Virtual Machine, BIOS unknown 2/2/2022
  Workqueue:  btrfs\_work\_helper \[btrfs\] (btrfs-endio-write)
  pstate: 404000c5 (nZcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
  pc : process\_one\_work+0x110/0x680
  lr : worker\_thread+0x1bc/0x360
  Call trace:
   process\_one\_work+0x110/0x680 (P)
   worker\_thread+0x1bc/0x360 (L)
   worker\_thread+0x1bc/0x360
   kthread+0x100/0x118
   ret\_from\_fork+0x10/0x20
  Code: f84086a1 f9000fe1 53041c21 b9003361 (f9400661)
  ---\[ end trace 0000000000000000 \]---
  Kernel panic - not syncing: Oops: Fatal exception
  SMP: stopping secondary CPUs
  SMP: failed to stop secondary CPUs 2-3
  Dumping ftrace buffer:
     (ftrace buffer empty)
  Kernel Offset: 0x275bb9540000 from 0xffff800080000000
  PHYS\_OFFSET: 0xffff8fbba0000000
  CPU features: 0x100,00000070,00801250,8201720b

\[CAUSE\]
The above warning is triggered immediately after the delalloc range
failure, this happens in the following sequence:

- Range \[1568K, 1636K) is dirty

   1536K  1568K     1600K    1636K  1664K
   \|      \|/////////\|////////\|      \|

  Where 1536K, 1600K and 1664K are page boundaries (64K page size)

- Enter extent\_writepage() for page 1536K

- Enter run\_delalloc\_nocow() with locke
---truncated---

## Affected and fixed versions

- Linux: \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 21333148b5c9e52f41fafcedec3810b56a5e0e40; \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 0283ee1912c8e243c931f4ee5b3672e954fe0384; \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 72dad8e377afa50435940adfb697e070d3556670; eb124aaa2e85e9dceac37be5b7166a04b9b26735; \>= 4.19.73, \< 4.20 (cvelist)
- Linux: 5.0 (cvelist)

## Mitigation

- Upgrade Linux to 4.20 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-58089. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-58089.md
Affected: Linux >= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, < 21333148b5c9e52f41fafcedec3810b56a5e0e40; >= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, < 0283ee1912c8e243c931f4ee5b3672e954fe0384; >= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, < 72dad8e377afa50435940adfb697e070d3556670; eb124aaa2e85e9dceac37be5b7…
Fixed in: Linux 21333148b5c9e52f41fafcedec3810b56a5e0e40, Linux 0283ee1912c8e243c931f4ee5b3672e954fe0384, Linux 72dad8e377afa50435940adfb697e070d3556670, Linux 4.20

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-58089 being exploited?

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

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

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

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

Linux \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 21333148b5c9e52f41fafcedec3810b56a5e0e40; \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 0283ee1912c8e243c931f4ee5b3672e954fe0384; \>= d1051d6ebf8ef3517a5a3cf82bba8436d190f1c2, \< 72dad8e377afa50435940adfb697e070d3556670; eb124aaa2e85e9dceac37be5b7166a04b9b26735; \>= 4.19.73, \< 4.20; Linux 5.0.

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

Yes. Fixed in Linux 21333148b5c9e52f41fafcedec3810b56a5e0e40, Linux 0283ee1912c8e243c931f4ee5b3672e954fe0384, Linux 72dad8e377afa50435940adfb697e070d3556670, Linux 4.20. Upgrade Linux to 4.20 or later.

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

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/21333148b5c9e52f41fafcedec3810b56a5e0e40>
- patch: <https://git.kernel.org/stable/c/0283ee1912c8e243c931f4ee5b3672e954fe0384>
- patch: <https://git.kernel.org/stable/c/72dad8e377afa50435940adfb697e070d3556670>

## 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-58089>

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