# CVE-2026-64593: btrfs: do not trim a device which is not writeable

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

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.22% (percentile 7, 2026-11-26)
- **Published:** 2026-08-06T07:13:49.700Z
- **Modified:** 2026-11-06T17:19:16.387Z

## Who should check

- Anyone running Linux \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< f41ae7e6664f3c4361129728f2c4d5f3ed995251; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 210af872eafa0cf572a84cb303c0f9d2914c1226; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 3d8fa4b828a86b33c60858e58aaab6df273ede05; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 9c894159c5b8adc84072e3af0e55b0473a69564e; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 02c903fc6fc7e16c5d1f22d18784f1208acf43e3; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 7a64521802997257b144e6edfb4e278dbeb972dd; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< b4af31b898a948e29861cb0bae734058f9a49d9b; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 1b1937eb08f51319bf71575484cde2b8c517aedc
- Anyone running Linux 4.3

## Description

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

btrfs: do not trim a device which is not writeable

\[BUG\]
There is a bug report that btrfs/242 can randomly fail with the
following NULL pointer dereference:

  run fstests btrfs/242 at 2026-06-01 10:25:08
  BTRFS: device fsid d4d7f234-487c-4787-88e4-47a8b68c9874 devid 1 transid 9 /dev/sdc (8:32) scanned by mount (122609)
  BTRFS info (device sdc): first mount of filesystem d4d7f234-487c-4787-88e4-47a8b68c9874
  BTRFS info (device sdc): using crc32c checksum algorithm
  BTRFS warning (device sdc): devid 2 uuid fbe72d72-3272-482d-80fb-ab88ed398192 is missing
  BTRFS warning (device sdc): devid 2 uuid fbe72d72-3272-482d-80fb-ab88ed398192 is missing
  BTRFS info (device sdc): allowing degraded mounts
  BTRFS info (device sdc): turning on async discard
  BTRFS info (device sdc): enabling free space tree
  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018
  user pgtable: 4k pages, 48-bit VAs, pgdp=000000013fd6b000
  CPU: 4 UID: 0 PID: 122625 Comm: fstrim Not tainted 7.0.10-2-default \#1 PREEMPT(full) openSUSE Tumbleweed e9a5f6b24978fba3bf015a992f865837fdfff3dd
  Hardware name: QEMU KVM Virtual Machine, BIOS edk2-20250812-19.fc42 08/12/2025
  pstate: 01400005 (nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
  pc : btrfs\_trim\_fs+0x34c/0xa00 \[btrfs\]
  lr : btrfs\_trim\_fs+0x1f0/0xa00 \[btrfs\]
  Call trace:
   btrfs\_trim\_fs+0x34c/0xa00 \[btrfs f02c1d570ceea621c69d302ba75dd61868083840\] (P)
   btrfs\_ioctl\_fitrim+0xe8/0x178 \[btrfs f02c1d570ceea621c69d302ba75dd61868083840\]
   btrfs\_ioctl+0xdd4/0x2bd8 \[btrfs f02c1d570ceea621c69d302ba75dd61868083840\]
   \_\_arm64\_sys\_ioctl+0xac/0x108
   invoke\_syscall.constprop.0+0x5c/0xd0
   el0\_svc\_common.constprop.0+0x40/0xf0
   do\_el0\_svc+0x24/0x40
   el0\_svc+0x40/0x1d0
   el0t\_64\_sync\_handler+0xa0/0xe8
   el0t\_64\_sync+0x1b0/0x1b8
  Code: 17ffff83 f94017e0 f9002be0 f9402ea0 (f9400c00)
  ---\[ end trace 0000000000000000  \]---

Also the reporter is very kind to test the following ASSERT() added to
btrfs\_trim\_free\_extents\_throttle():

	ASSERT(device-\>bdev,
	       "devid=%llu path=%s dev\_state=0x%lx\\n",
	       device-\>devid, btrfs\_dev\_name(device), device-\>dev\_state);

And it shows the following output:

  assertion failed: device-\>bdev, in extent-tree.c:6630 (devid=2 path=/dev/sdd dev\_state=0x82)

Which means the device-\>bdev is NULL, and the dev\_state is
BTRFS\_DEV\_STATE\_IN\_FS\_METADATA \| BTRFS\_DEV\_STATE\_ITEM\_FOUND, without
BTRFS\_DEV\_STATE\_WRITEABLE flag set.

\[CAUSE\]
The pc points to the following call chain:

  btrfs\_trim\_fs()
  \|- btrfs\_trim\_free\_extents()
     \|- btrfs\_trim\_free\_extents\_throttle()
        \|- bdev\_max\_discard\_sectors(device-\>bdev)

So the NULL pointer dereference is caused by device-\>bdev being NULL.

This looks impossible by a quick glance, as just before calling
btrfs\_trim\_free\_extents\_throttle(), we have skipped any device that has
BTRFS\_DEV\_STATE\_MISSING flag set.

However in this particular case, there is a window where the missing
device is later re-scanned, causing btrfs to remove the
BTRFS\_DEV\_STATE\_MISSING flag:

  btrfs\_control\_ioctl()
  \|- btrfs\_scan\_one\_device()
     \|- device\_list\_add()
        \|- rcu\_assign\_pointer(device-\>name, name);
        \|  This updates the missing device's path to the new good path.
        \|
        \|- clear\_bit(BTRFS\_DEV\_STATE\_MISSING, &device-\>dev\_state)
           This removes the BTRFS\_DEV\_STATE\_MISSING flag.

This allows the missing device to re-appear and clear the
BTRFS\_DEV\_STATE\_MISSING flag.  However the device still does not have
the BTRFS\_DEV\_STATE\_WRITEABLE flag set, nor is its bdev pointer updated.

The bdev pointer remains NULL, triggering the crash later.

\[FIX\]
This is a big de-synchronization between BTRFS\_DEV\_STATE\_MISSING and
device-\>bdev pointer, and shows a gap in btrfs's re-appearing-device
handling.

The proper handling of re-appearing device will need quite some extra
work, which is out of the context of this small
---truncated---

## Affected and fixed versions

- Linux: \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< f41ae7e6664f3c4361129728f2c4d5f3ed995251; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 210af872eafa0cf572a84cb303c0f9d2914c1226; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 3d8fa4b828a86b33c60858e58aaab6df273ede05; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 9c894159c5b8adc84072e3af0e55b0473a69564e; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 02c903fc6fc7e16c5d1f22d18784f1208acf43e3; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 7a64521802997257b144e6edfb4e278dbeb972dd; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< b4af31b898a948e29861cb0bae734058f9a49d9b; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 1b1937eb08f51319bf71575484cde2b8c517aedc (cvelist)
- Linux: 4.3 (cvelist)

## Mitigation

- Upgrade Linux to 1b1937eb08f51319bf71575484cde2b8c517aedc or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2026-64593.md
Affected: Linux >= 499f377f49f085ee4aa214c738e948e88626f39b, < f41ae7e6664f3c4361129728f2c4d5f3ed995251; >= 499f377f49f085ee4aa214c738e948e88626f39b, < 210af872eafa0cf572a84cb303c0f9d2914c1226; >= 499f377f49f085ee4aa214c738e948e88626f39b, < 3d8fa4b828a86b33c60858e58aaab6df273ede05; >= 499f377f49f085ee4aa214c…
Fixed in: Linux 210af872eafa0cf572a84cb303c0f9d2914c1226, Linux 3d8fa4b828a86b33c60858e58aaab6df273ede05, Linux 9c894159c5b8adc84072e3af0e55b0473a69564e, Linux 02c903fc6fc7e16c5d1f22d18784f1208acf43e3, Linux 7a64521802997257b144e6edfb4e278dbeb972dd, Linux 1b1937eb08f51319bf71575484cde2b8c517aedc

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-2026-64593 being exploited?

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

### How serious is CVE-2026-64593?

It has no CVSS score yet. Unknown.

### Which versions are affected by CVE-2026-64593?

Linux \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< f41ae7e6664f3c4361129728f2c4d5f3ed995251; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 210af872eafa0cf572a84cb303c0f9d2914c1226; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 3d8fa4b828a86b33c60858e58aaab6df273ede05; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 9c894159c5b8adc84072e3af0e55b0473a69564e; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 02c903fc6fc7e16c5d1f22d18784f1208acf43e3; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 7a64521802997257b144e6edfb4e278dbeb972dd; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< b4af31b898a948e29861cb0bae734058f9a49d9b; \>= 499f377f49f085ee4aa214c738e948e88626f39b, \< 1b1937eb08f51319bf71575484cde2b8c517aedc; Linux 4.3.

### Is there a fix for CVE-2026-64593?

Yes. Fixed in Linux 210af872eafa0cf572a84cb303c0f9d2914c1226, Linux 3d8fa4b828a86b33c60858e58aaab6df273ede05, Linux 9c894159c5b8adc84072e3af0e55b0473a69564e, Linux 02c903fc6fc7e16c5d1f22d18784f1208acf43e3, Linux 7a64521802997257b144e6edfb4e278dbeb972dd, Linux 1b1937eb08f51319bf71575484cde2b8c517aedc. Upgrade Linux to 1b1937eb08f51319bf71575484cde2b8c517aedc or later.

### How do I check if I'm affected by CVE-2026-64593?

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

- other: <https://git.kernel.org/stable/c/f41ae7e6664f3c4361129728f2c4d5f3ed995251>
- other: <https://git.kernel.org/stable/c/210af872eafa0cf572a84cb303c0f9d2914c1226>
- other: <https://git.kernel.org/stable/c/3d8fa4b828a86b33c60858e58aaab6df273ede05>
- other: <https://git.kernel.org/stable/c/9c894159c5b8adc84072e3af0e55b0473a69564e>
- other: <https://git.kernel.org/stable/c/02c903fc6fc7e16c5d1f22d18784f1208acf43e3>
- other: <https://git.kernel.org/stable/c/7a64521802997257b144e6edfb4e278dbeb972dd>
- other: <https://git.kernel.org/stable/c/b4af31b898a948e29861cb0bae734058f9a49d9b>
- other: <https://git.kernel.org/stable/c/1b1937eb08f51319bf71575484cde2b8c517aedc>

## 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-2026-64593>

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