# CVE-2024-26944: btrfs: zoned: fix use-after-free in do\_zone\_finish()

> 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 16, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2024-05-01T05:18:04.909Z
- **Modified:** 2026-08-05T11:28:29.917Z

## Who should check

- Anyone running Linux \>= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, \< 34ca809e055eca5cfe63d9c7efbf80b7c21b4e57; \>= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, \< 1ec17ef59168a1a6f1105f5dc517f783839a5302
- Anyone running Linux 5.18

## Description

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

btrfs: zoned: fix use-after-free in do\_zone\_finish()

Shinichiro reported the following use-after-free triggered by the device
replace operation in fstests btrfs/070.

 BTRFS info (device nullb1): scrub: finished on devid 1 with status: 0
 ==================================================================
 BUG: KASAN: slab-use-after-free in do\_zone\_finish+0x91a/0xb90 \[btrfs\]
 Read of size 8 at addr ffff8881543c8060 by task btrfs-cleaner/3494007

 CPU: 0 PID: 3494007 Comm: btrfs-cleaner Tainted: G        W          6.8.0-rc5-kts \#1
 Hardware name: Supermicro Super Server/X11SPi-TF, BIOS 3.3 02/21/2020
 Call Trace:
  \<TASK\>
  dump\_stack\_lvl+0x5b/0x90
  print\_report+0xcf/0x670
  ? \_\_virt\_addr\_valid+0x200/0x3e0
  kasan\_report+0xd8/0x110
  ? do\_zone\_finish+0x91a/0xb90 \[btrfs\]
  ? do\_zone\_finish+0x91a/0xb90 \[btrfs\]
  do\_zone\_finish+0x91a/0xb90 \[btrfs\]
  btrfs\_delete\_unused\_bgs+0x5e1/0x1750 \[btrfs\]
  ? \_\_pfx\_btrfs\_delete\_unused\_bgs+0x10/0x10 \[btrfs\]
  ? btrfs\_put\_root+0x2d/0x220 \[btrfs\]
  ? btrfs\_clean\_one\_deleted\_snapshot+0x299/0x430 \[btrfs\]
  cleaner\_kthread+0x21e/0x380 \[btrfs\]
  ? \_\_pfx\_cleaner\_kthread+0x10/0x10 \[btrfs\]
  kthread+0x2e3/0x3c0
  ? \_\_pfx\_kthread+0x10/0x10
  ret\_from\_fork+0x31/0x70
  ? \_\_pfx\_kthread+0x10/0x10
  ret\_from\_fork\_asm+0x1b/0x30
  \</TASK\>

 Allocated by task 3493983:
  kasan\_save\_stack+0x33/0x60
  kasan\_save\_track+0x14/0x30
  \_\_kasan\_kmalloc+0xaa/0xb0
  btrfs\_alloc\_device+0xb3/0x4e0 \[btrfs\]
  device\_list\_add.constprop.0+0x993/0x1630 \[btrfs\]
  btrfs\_scan\_one\_device+0x219/0x3d0 \[btrfs\]
  btrfs\_control\_ioctl+0x26e/0x310 \[btrfs\]
  \_\_x64\_sys\_ioctl+0x134/0x1b0
  do\_syscall\_64+0x99/0x190
  entry\_SYSCALL\_64\_after\_hwframe+0x6e/0x76

 Freed by task 3494056:
  kasan\_save\_stack+0x33/0x60
  kasan\_save\_track+0x14/0x30
  kasan\_save\_free\_info+0x3f/0x60
  poison\_slab\_object+0x102/0x170
  \_\_kasan\_slab\_free+0x32/0x70
  kfree+0x11b/0x320
  btrfs\_rm\_dev\_replace\_free\_srcdev+0xca/0x280 \[btrfs\]
  btrfs\_dev\_replace\_finishing+0xd7e/0x14f0 \[btrfs\]
  btrfs\_dev\_replace\_by\_ioctl+0x1286/0x25a0 \[btrfs\]
  btrfs\_ioctl+0xb27/0x57d0 \[btrfs\]
  \_\_x64\_sys\_ioctl+0x134/0x1b0
  do\_syscall\_64+0x99/0x190
  entry\_SYSCALL\_64\_after\_hwframe+0x6e/0x76

 The buggy address belongs to the object at ffff8881543c8000
  which belongs to the cache kmalloc-1k of size 1024
 The buggy address is located 96 bytes inside of
  freed 1024-byte region \[ffff8881543c8000, ffff8881543c8400)

 The buggy address belongs to the physical page:
 page:00000000fe2c1285 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1543c8
 head:00000000fe2c1285 order:3 entire\_mapcount:0 nr\_pages\_mapped:0 pincount:0
 flags: 0x17ffffc0000840(slab\|head\|node=0\|zone=2\|lastcpupid=0x1fffff)
 page\_type: 0xffffffff()
 raw: 0017ffffc0000840 ffff888100042dc0 ffffea0019e8f200 dead000000000002
 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
 page dumped because: kasan: bad access detected

 Memory state around the buggy address:
  ffff8881543c7f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  ffff8881543c7f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 \>ffff8881543c8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                        ^
  ffff8881543c8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff8881543c8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

This UAF happens because we're accessing stale zone information of a
already removed btrfs\_device in do\_zone\_finish().

The sequence of events is as follows:

btrfs\_dev\_replace\_start
  btrfs\_scrub\_dev
   btrfs\_dev\_replace\_finishing
    btrfs\_dev\_replace\_update\_device\_in\_mapping\_tree \<-- devices replaced
    btrfs\_rm\_dev\_replace\_free\_srcdev
     btrfs\_free\_device                              \<-- device freed

cleaner\_kthread
 btrfs\_delete\_unused\_bgs
  btrfs\_zone\_finish
   do\_zone\_finish              \<-- refers the freed device

The reason for this is that we're using a
---truncated---

## Affected and fixed versions

- Linux: \>= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, \< 34ca809e055eca5cfe63d9c7efbf80b7c21b4e57; \>= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, \< 1ec17ef59168a1a6f1105f5dc517f783839a5302 (cvelist)
- Linux: 5.18 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2024-26944.md
Affected: Linux >= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, < 34ca809e055eca5cfe63d9c7efbf80b7c21b4e57; >= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, < 1ec17ef59168a1a6f1105f5dc517f783839a5302; Linux 5.18
Fixed in: Linux 34ca809e055eca5cfe63d9c7efbf80b7c21b4e57, Linux 1ec17ef59168a1a6f1105f5dc517f783839a5302

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

There is no confirmed exploitation: CVE-2024-26944 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-26944?

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

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

Linux \>= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, \< 34ca809e055eca5cfe63d9c7efbf80b7c21b4e57; \>= 4dcbb8ab31c1292aea6a3f240e19523f633320c2, \< 1ec17ef59168a1a6f1105f5dc517f783839a5302; Linux 5.18.

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

Yes. Fixed in Linux 34ca809e055eca5cfe63d9c7efbf80b7c21b4e57, Linux 1ec17ef59168a1a6f1105f5dc517f783839a5302. Upgrade Linux to 1ec17ef59168a1a6f1105f5dc517f783839a5302 or later.

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

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/34ca809e055eca5cfe63d9c7efbf80b7c21b4e57>
- patch: <https://git.kernel.org/stable/c/1ec17ef59168a1a6f1105f5dc517f783839a5302>

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

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