# CVE-2025-21754: btrfs: fix assertion failure when splitting ordered extent after transaction abort

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

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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 18, 2026-11-28)
- **CWE:** CWE-617
- **Published:** 2025-02-27T02:12:23.738Z
- **Modified:** 2026-06-17T08:44:11.787Z

## Who should check

- Anyone running Linux \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 927b930f117bbae730a853c1dc43da8afe8380fa; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 0ff88c2a742a7cbaa4d08507d864737d099b435a; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 8ea8db4216d1029527ab4666f730650419451e32; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 0d85f5c2dd91df6b5da454406756f463ba923b69
- Anyone running Linux 6.5

## Description

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

btrfs: fix assertion failure when splitting ordered extent after transaction abort

If while we are doing a direct IO write a transaction abort happens, we
mark all existing ordered extents with the BTRFS\_ORDERED\_IOERR flag (done
at btrfs\_destroy\_ordered\_extents()), and then after that if we enter
btrfs\_split\_ordered\_extent() and the ordered extent has bytes left
(meaning we have a bio that doesn't cover the whole ordered extent, see
details at btrfs\_extract\_ordered\_extent()), we will fail on the following
assertion at btrfs\_split\_ordered\_extent():

   ASSERT(!(flags & ~BTRFS\_ORDERED\_TYPE\_FLAGS));

because the BTRFS\_ORDERED\_IOERR flag is set and the definition of
BTRFS\_ORDERED\_TYPE\_FLAGS is just the union of all flags that identify the
type of write (regular, nocow, prealloc, compressed, direct IO, encoded).

Fix this by returning an error from btrfs\_extract\_ordered\_extent() if we
find the BTRFS\_ORDERED\_IOERR flag in the ordered extent. The error will
be the error that resulted in the transaction abort or -EIO if no
transaction abort happened.

This was recently reported by syzbot with the following trace:

   FAULT\_INJECTION: forcing a failure.
   name failslab, interval 1, probability 0, space 0, times 1
   CPU: 0 UID: 0 PID: 5321 Comm: syz.0.0 Not tainted 6.13.0-rc5-syzkaller \#0
   Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
   Call Trace:
    \<TASK\>
    \_\_dump\_stack lib/dump\_stack.c:94 \[inline\]
    dump\_stack\_lvl+0x241/0x360 lib/dump\_stack.c:120
    fail\_dump lib/fault-inject.c:53 \[inline\]
    should\_fail\_ex+0x3b0/0x4e0 lib/fault-inject.c:154
    should\_failslab+0xac/0x100 mm/failslab.c:46
    slab\_pre\_alloc\_hook mm/slub.c:4072 \[inline\]
    slab\_alloc\_node mm/slub.c:4148 \[inline\]
    \_\_do\_kmalloc\_node mm/slub.c:4297 \[inline\]
    \_\_kmalloc\_noprof+0xdd/0x4c0 mm/slub.c:4310
    kmalloc\_noprof include/linux/slab.h:905 \[inline\]
    kzalloc\_noprof include/linux/slab.h:1037 \[inline\]
    btrfs\_chunk\_alloc\_add\_chunk\_item+0x244/0x1100 fs/btrfs/volumes.c:5742
    reserve\_chunk\_space+0x1ca/0x2c0 fs/btrfs/block-group.c:4292
    check\_system\_chunk fs/btrfs/block-group.c:4319 \[inline\]
    do\_chunk\_alloc fs/btrfs/block-group.c:3891 \[inline\]
    btrfs\_chunk\_alloc+0x77b/0xf80 fs/btrfs/block-group.c:4187
    find\_free\_extent\_update\_loop fs/btrfs/extent-tree.c:4166 \[inline\]
    find\_free\_extent+0x42d1/0x5810 fs/btrfs/extent-tree.c:4579
    btrfs\_reserve\_extent+0x422/0x810 fs/btrfs/extent-tree.c:4672
    btrfs\_new\_extent\_direct fs/btrfs/direct-io.c:186 \[inline\]
    btrfs\_get\_blocks\_direct\_write+0x706/0xfa0 fs/btrfs/direct-io.c:321
    btrfs\_dio\_iomap\_begin+0xbb7/0x1180 fs/btrfs/direct-io.c:525
    iomap\_iter+0x697/0xf60 fs/iomap/iter.c:90
    \_\_iomap\_dio\_rw+0xeb9/0x25b0 fs/iomap/direct-io.c:702
    btrfs\_dio\_write fs/btrfs/direct-io.c:775 \[inline\]
    btrfs\_direct\_write+0x610/0xa30 fs/btrfs/direct-io.c:880
    btrfs\_do\_write\_iter+0x2a0/0x760 fs/btrfs/file.c:1397
    do\_iter\_readv\_writev+0x600/0x880
    vfs\_writev+0x376/0xba0 fs/read\_write.c:1050
    do\_pwritev fs/read\_write.c:1146 \[inline\]
    \_\_do\_sys\_pwritev2 fs/read\_write.c:1204 \[inline\]
    \_\_se\_sys\_pwritev2+0x196/0x2b0 fs/read\_write.c:1195
    do\_syscall\_x64 arch/x86/entry/common.c:52 \[inline\]
    do\_syscall\_64+0xf3/0x230 arch/x86/entry/common.c:83
    entry\_SYSCALL\_64\_after\_hwframe+0x77/0x7f
   RIP: 0033:0x7f1281f85d29
   RSP: 002b:00007f12819fe038 EFLAGS: 00000246 ORIG\_RAX: 0000000000000148
   RAX: ffffffffffffffda RBX: 00007f1282176080 RCX: 00007f1281f85d29
   RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000005
   RBP: 00007f12819fe090 R08: 0000000000000000 R09: 0000000000000003
   R10: 0000000000007000 R11: 0000000000000246 R12: 0000000000000002
   R13: 0000000000000000 R14: 00007f1282176080 R15: 00007ffcb9e23328
    \</TASK\>
   BTRFS error (device loop0 state A): Transaction aborted (error -12)
   BTRFS: error (device loop0 state A
---truncated---

## Affected and fixed versions

- Linux: \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 927b930f117bbae730a853c1dc43da8afe8380fa; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 0ff88c2a742a7cbaa4d08507d864737d099b435a; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 8ea8db4216d1029527ab4666f730650419451e32; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 0d85f5c2dd91df6b5da454406756f463ba923b69 (cvelist)
- Linux: 6.5 (cvelist)

## Mitigation

- Upgrade Linux to 0d85f5c2dd91df6b5da454406756f463ba923b69 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-21754.md
Affected: Linux >= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, < 927b930f117bbae730a853c1dc43da8afe8380fa; >= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, < 0ff88c2a742a7cbaa4d08507d864737d099b435a; >= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, < 8ea8db4216d1029527ab4666f730650419451e32; >= 52b1fdca23ac0fbcad363a1…
Fixed in: Linux 927b930f117bbae730a853c1dc43da8afe8380fa, Linux 0ff88c2a742a7cbaa4d08507d864737d099b435a, Linux 8ea8db4216d1029527ab4666f730650419451e32, Linux 0d85f5c2dd91df6b5da454406756f463ba923b69

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-2025-21754 being exploited?

There is no confirmed exploitation: CVE-2025-21754 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-28).

### How serious is CVE-2025-21754?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-21754?

Linux \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 927b930f117bbae730a853c1dc43da8afe8380fa; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 0ff88c2a742a7cbaa4d08507d864737d099b435a; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 8ea8db4216d1029527ab4666f730650419451e32; \>= 52b1fdca23ac0fbcad363a1a5b426bf0d56b715a, \< 0d85f5c2dd91df6b5da454406756f463ba923b69; Linux 6.5.

### Is there a fix for CVE-2025-21754?

Yes. Fixed in Linux 927b930f117bbae730a853c1dc43da8afe8380fa, Linux 0ff88c2a742a7cbaa4d08507d864737d099b435a, Linux 8ea8db4216d1029527ab4666f730650419451e32, Linux 0d85f5c2dd91df6b5da454406756f463ba923b69. Upgrade Linux to 0d85f5c2dd91df6b5da454406756f463ba923b69 or later.

### How do I check if I'm affected by CVE-2025-21754?

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/927b930f117bbae730a853c1dc43da8afe8380fa>
- patch: <https://git.kernel.org/stable/c/0ff88c2a742a7cbaa4d08507d864737d099b435a>
- patch: <https://git.kernel.org/stable/c/8ea8db4216d1029527ab4666f730650419451e32>
- patch: <https://git.kernel.org/stable/c/0d85f5c2dd91df6b5da454406756f463ba923b69>

## 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-2025-21754>

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