# CVE-2025-21752: btrfs: don't use btrfs\_set\_item\_key\_safe on RAID stripe-extents

> 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.24% (percentile 9, 2026-11-26)
- **Published:** 2025-02-27T02:12:22.741Z
- **Modified:** 2026-06-17T08:44:11.443Z

## Who should check

- Anyone running Linux \>= 02c372e1f016e5113217597ab37b399c4e407477, \< 1c25eff52ee5a02a2c4be659a44ae972d9989742; \>= 02c372e1f016e5113217597ab37b399c4e407477, \< dc14ba10781bd2629835696b7cc1febf914768e9; ab69bf6f8970c09d3735c25094e9471d54365282; \>= 6.6.130, \< 6.7
- Anyone running Linux 6.7

## Description

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

btrfs: don't use btrfs\_set\_item\_key\_safe on RAID stripe-extents

Don't use btrfs\_set\_item\_key\_safe() to modify the keys in the RAID
stripe-tree, as this can lead to corruption of the tree, which is caught
by the checks in btrfs\_set\_item\_key\_safe():

 BTRFS info (device nvme1n1): leaf 49168384 gen 15 total ptrs 194 free space 8329 owner 12
 BTRFS info (device nvme1n1): refs 2 lock\_owner 1030 current 1030
  \[ snip \]
  item 105 key (354549760 230 20480) itemoff 14587 itemsize 16
                  stride 0 devid 5 physical 67502080
  item 106 key (354631680 230 4096) itemoff 14571 itemsize 16
                  stride 0 devid 1 physical 88559616
  item 107 key (354631680 230 32768) itemoff 14555 itemsize 16
                  stride 0 devid 1 physical 88555520
  item 108 key (354717696 230 28672) itemoff 14539 itemsize 16
                  stride 0 devid 2 physical 67604480
  \[ snip \]
 BTRFS critical (device nvme1n1): slot 106 key (354631680 230 32768) new key (354635776 230 4096)
 ------------\[ cut here \]------------
 kernel BUG at fs/btrfs/ctree.c:2602!
 Oops: invalid opcode: 0000 \[\#1\] PREEMPT SMP PTI
 CPU: 1 UID: 0 PID: 1055 Comm: fsstress Not tainted 6.13.0-rc1+ \#1464
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
 RIP: 0010:btrfs\_set\_item\_key\_safe+0xf7/0x270
 Code: \<snip\>
 RSP: 0018:ffffc90001337ab0 EFLAGS: 00010287
 RAX: 0000000000000000 RBX: ffff8881115fd000 RCX: 0000000000000000
 RDX: 0000000000000001 RSI: 0000000000000001 RDI: 00000000ffffffff
 RBP: ffff888110ed6f50 R08: 00000000ffffefff R09: ffffffff8244c500
 R10: 00000000ffffefff R11: 00000000ffffffff R12: ffff888100586000
 R13: 00000000000000c9 R14: ffffc90001337b1f R15: ffff888110f23b58
 FS:  00007f7d75c72740(0000) GS:ffff88813bd00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 00007fa811652c60 CR3: 0000000111398001 CR4: 0000000000370eb0
 Call Trace:
  \<TASK\>
  ? \_\_die\_body.cold+0x14/0x1a
  ? die+0x2e/0x50
  ? do\_trap+0xca/0x110
  ? do\_error\_trap+0x65/0x80
  ? btrfs\_set\_item\_key\_safe+0xf7/0x270
  ? exc\_invalid\_op+0x50/0x70
  ? btrfs\_set\_item\_key\_safe+0xf7/0x270
  ? asm\_exc\_invalid\_op+0x1a/0x20
  ? btrfs\_set\_item\_key\_safe+0xf7/0x270
  btrfs\_partially\_delete\_raid\_extent+0xc4/0xe0
  btrfs\_delete\_raid\_extent+0x227/0x240
  \_\_btrfs\_free\_extent.isra.0+0x57f/0x9c0
  ? exc\_coproc\_segment\_overrun+0x40/0x40
  \_\_btrfs\_run\_delayed\_refs+0x2fa/0xe80
  btrfs\_run\_delayed\_refs+0x81/0xe0
  btrfs\_commit\_transaction+0x2dd/0xbe0
  ? preempt\_count\_add+0x52/0xb0
  btrfs\_sync\_file+0x375/0x4c0
  do\_fsync+0x39/0x70
  \_\_x64\_sys\_fsync+0x13/0x20
  do\_syscall\_64+0x54/0x110
  entry\_SYSCALL\_64\_after\_hwframe+0x76/0x7e
 RIP: 0033:0x7f7d7550ef90
 Code: \<snip\>
 RSP: 002b:00007ffd70237248 EFLAGS: 00000202 ORIG\_RAX: 000000000000004a
 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f7d7550ef90
 RDX: 000000000000013a RSI: 000000000040eb28 RDI: 0000000000000004
 RBP: 000000000000001b R08: 0000000000000078 R09: 00007ffd7023725c
 R10: 00007f7d75400390 R11: 0000000000000202 R12: 028f5c28f5c28f5c
 R13: 8f5c28f5c28f5c29 R14: 000000000040b520 R15: 00007f7d75c726c8
  \</TASK\>

While the root cause of the tree order corruption isn't clear, using
btrfs\_duplicate\_item() to copy the item and then adjusting both the key
and the per-device physical addresses is a safe way to counter this
problem.

## Affected and fixed versions

- Linux: \>= 02c372e1f016e5113217597ab37b399c4e407477, \< 1c25eff52ee5a02a2c4be659a44ae972d9989742; \>= 02c372e1f016e5113217597ab37b399c4e407477, \< dc14ba10781bd2629835696b7cc1febf914768e9; ab69bf6f8970c09d3735c25094e9471d54365282; \>= 6.6.130, \< 6.7 (cvelist)
- Linux: 6.7 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2025-21752.md
Affected: Linux >= 02c372e1f016e5113217597ab37b399c4e407477, < 1c25eff52ee5a02a2c4be659a44ae972d9989742; >= 02c372e1f016e5113217597ab37b399c4e407477, < dc14ba10781bd2629835696b7cc1febf914768e9; ab69bf6f8970c09d3735c25094e9471d54365282; >= 6.6.130, < 6.7; Linux 6.7
Fixed in: Linux 1c25eff52ee5a02a2c4be659a44ae972d9989742, Linux 6.7

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

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

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

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

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

Linux \>= 02c372e1f016e5113217597ab37b399c4e407477, \< 1c25eff52ee5a02a2c4be659a44ae972d9989742; \>= 02c372e1f016e5113217597ab37b399c4e407477, \< dc14ba10781bd2629835696b7cc1febf914768e9; ab69bf6f8970c09d3735c25094e9471d54365282; \>= 6.6.130, \< 6.7; Linux 6.7.

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

Yes. Fixed in Linux 1c25eff52ee5a02a2c4be659a44ae972d9989742, Linux 6.7. Upgrade Linux to 6.7 or later.

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

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/1c25eff52ee5a02a2c4be659a44ae972d9989742>
- patch: <https://git.kernel.org/stable/c/dc14ba10781bd2629835696b7cc1febf914768e9>

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

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