# CVE-2024-26792: btrfs: fix double free of anonymous device after snapshot creation failure

> 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.33% (percentile 18, 2026-11-26)
- **CWE:** CWE-415
- **Published:** 2024-04-04T08:20:23.075Z
- **Modified:** 2026-08-05T11:27:16.252Z

## Who should check

- Anyone running Linux \>= 66b317a2fc45b2ef66527ee3f8fa08fb5beab88d, \< c34adc20b91a8e55e048b18d63f4f4ae003ecf8f; \>= 833775656d447c545133a744a0ed1e189ce61430, \< eb3441093aad251418921246fc3b224fd1575701; \>= 5a172344bfdabb46458e03708735d7b1a918c468, \< c8ab7521665bd0f8bc4a900244d1d5a7095cc3b9; \>= e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb, \< e2b54eaf28df0c978626c9736b94f003b523b451; 3f5d47eb163bceb1b9e613c9003bae5fefc0046f; e31546b0f34af21738c4ceac47d662c00ee6382f; \>= 5.10.210, \< 5.11; \>= 5.15.149, \< 5.16
- Anyone running Linux \>= 6.1.79, \< 6.1.81; \>= 6.6.18, \< 6.6.21; \>= 6.7.6, \< 6.7.9

## Description

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

btrfs: fix double free of anonymous device after snapshot creation failure

When creating a snapshot we may do a double free of an anonymous device
in case there's an error committing the transaction. The second free may
result in freeing an anonymous device number that was allocated by some
other subsystem in the kernel or another btrfs filesystem.

The steps that lead to this:

1) At ioctl.c:create\_snapshot() we allocate an anonymous device number
   and assign it to pending\_snapshot-\>anon\_dev;

2) Then we call btrfs\_commit\_transaction() and end up at
   transaction.c:create\_pending\_snapshot();

3) There we call btrfs\_get\_new\_fs\_root() and pass it the anonymous device
   number stored in pending\_snapshot-\>anon\_dev;

4) btrfs\_get\_new\_fs\_root() frees that anonymous device number because
   btrfs\_lookup\_fs\_root() returned a root - someone else did a lookup
   of the new root already, which could some task doing backref walking;

5) After that some error happens in the transaction commit path, and at
   ioctl.c:create\_snapshot() we jump to the 'fail' label, and after
   that we free again the same anonymous device number, which in the
   meanwhile may have been reallocated somewhere else, because
   pending\_snapshot-\>anon\_dev still has the same value as in step 1.

Recently syzbot ran into this and reported the following trace:

  ------------\[ cut here \]------------
  ida\_free called for id=51 which is not allocated.
  WARNING: CPU: 1 PID: 31038 at lib/idr.c:525 ida\_free+0x370/0x420 lib/idr.c:525
  Modules linked in:
  CPU: 1 PID: 31038 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-00410-gc02197fc9076 \#0
  Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
  RIP: 0010:ida\_free+0x370/0x420 lib/idr.c:525
  Code: 10 42 80 3c 28 (...)
  RSP: 0018:ffffc90015a67300 EFLAGS: 00010246
  RAX: be5130472f5dd000 RBX: 0000000000000033 RCX: 0000000000040000
  RDX: ffffc90009a7a000 RSI: 000000000003ffff RDI: 0000000000040000
  RBP: ffffc90015a673f0 R08: ffffffff81577992 R09: 1ffff92002b4cdb4
  R10: dffffc0000000000 R11: fffff52002b4cdb5 R12: 0000000000000246
  R13: dffffc0000000000 R14: ffffffff8e256b80 R15: 0000000000000246
  FS:  00007fca3f4b46c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00007f167a17b978 CR3: 000000001ed26000 CR4: 0000000000350ef0
  Call Trace:
   \<TASK\>
   btrfs\_get\_root\_ref+0xa48/0xaf0 fs/btrfs/disk-io.c:1346
   create\_pending\_snapshot+0xff2/0x2bc0 fs/btrfs/transaction.c:1837
   create\_pending\_snapshots+0x195/0x1d0 fs/btrfs/transaction.c:1931
   btrfs\_commit\_transaction+0xf1c/0x3740 fs/btrfs/transaction.c:2404
   create\_snapshot+0x507/0x880 fs/btrfs/ioctl.c:848
   btrfs\_mksubvol+0x5d0/0x750 fs/btrfs/ioctl.c:998
   btrfs\_mksnapshot+0xb5/0xf0 fs/btrfs/ioctl.c:1044
   \_\_btrfs\_ioctl\_snap\_create+0x387/0x4b0 fs/btrfs/ioctl.c:1306
   btrfs\_ioctl\_snap\_create\_v2+0x1ca/0x400 fs/btrfs/ioctl.c:1393
   btrfs\_ioctl+0xa74/0xd40
   vfs\_ioctl fs/ioctl.c:51 \[inline\]
   \_\_do\_sys\_ioctl fs/ioctl.c:871 \[inline\]
   \_\_se\_sys\_ioctl+0xfe/0x170 fs/ioctl.c:857
   do\_syscall\_64+0xfb/0x240
   entry\_SYSCALL\_64\_after\_hwframe+0x6f/0x77
  RIP: 0033:0x7fca3e67dda9
  Code: 28 00 00 00 (...)
  RSP: 002b:00007fca3f4b40c8 EFLAGS: 00000246 ORIG\_RAX: 0000000000000010
  RAX: ffffffffffffffda RBX: 00007fca3e7abf80 RCX: 00007fca3e67dda9
  RDX: 00000000200005c0 RSI: 0000000050009417 RDI: 0000000000000003
  RBP: 00007fca3e6ca47a R08: 0000000000000000 R09: 0000000000000000
  R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
  R13: 000000000000000b R14: 00007fca3e7abf80 R15: 00007fff6bf95658
   \</TASK\>

Where we get an explicit message where we attempt to free an anonymous
device number that is not currently allocated. It happens in a different
code path from the example below, at btrfs\_get\_root\_ref(), so this change
may not fix the case triggered by sy
---truncated---

## Affected and fixed versions

- Linux: \>= 66b317a2fc45b2ef66527ee3f8fa08fb5beab88d, \< c34adc20b91a8e55e048b18d63f4f4ae003ecf8f; \>= 833775656d447c545133a744a0ed1e189ce61430, \< eb3441093aad251418921246fc3b224fd1575701; \>= 5a172344bfdabb46458e03708735d7b1a918c468, \< c8ab7521665bd0f8bc4a900244d1d5a7095cc3b9; \>= e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb, \< e2b54eaf28df0c978626c9736b94f003b523b451; 3f5d47eb163bceb1b9e613c9003bae5fefc0046f; e31546b0f34af21738c4ceac47d662c00ee6382f; \>= 5.10.210, \< 5.11; \>= 5.15.149, \< 5.16 (cvelist)
- Linux: \>= 6.1.79, \< 6.1.81; \>= 6.6.18, \< 6.6.21; \>= 6.7.6, \< 6.7.9 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2024-26792.md
Affected: Linux >= 66b317a2fc45b2ef66527ee3f8fa08fb5beab88d, < c34adc20b91a8e55e048b18d63f4f4ae003ecf8f; >= 833775656d447c545133a744a0ed1e189ce61430, < eb3441093aad251418921246fc3b224fd1575701; >= 5a172344bfdabb46458e03708735d7b1a918c468, < c8ab7521665bd0f8bc4a900244d1d5a7095cc3b9; >= e03ee2fe873eb68c1f9ba51…
Fixed in: Linux 5.11, Linux 5.16, Linux 6.1.81, Linux 6.6.21, Linux 6.7.9

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

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

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

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

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

Linux \>= 66b317a2fc45b2ef66527ee3f8fa08fb5beab88d, \< c34adc20b91a8e55e048b18d63f4f4ae003ecf8f; \>= 833775656d447c545133a744a0ed1e189ce61430, \< eb3441093aad251418921246fc3b224fd1575701; \>= 5a172344bfdabb46458e03708735d7b1a918c468, \< c8ab7521665bd0f8bc4a900244d1d5a7095cc3b9; \>= e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb, \< e2b54eaf28df0c978626c9736b94f003b523b451; 3f5d47eb163bceb1b9e613c9003bae5fefc0046f; e31546b0f34af21738c4ceac47d662c00ee6382f; \>= 5.10.210, \< 5.11; \>= 5.15.149, \< 5.16; Linux \>= 6.1.79, \< 6.1.81; \>= 6.6.18, \< 6.6.21; \>= 6.7.6, \< 6.7.9.

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

Yes. Fixed in Linux 5.11, Linux 5.16, Linux 6.1.81, Linux 6.6.21, Linux 6.7.9. Upgrade Linux to 5.16 or later. Upgrade Linux to 6.7.9 or later.

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

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/c34adc20b91a8e55e048b18d63f4f4ae003ecf8f>
- patch: <https://git.kernel.org/stable/c/eb3441093aad251418921246fc3b224fd1575701>
- patch: <https://git.kernel.org/stable/c/c8ab7521665bd0f8bc4a900244d1d5a7095cc3b9>
- patch: <https://git.kernel.org/stable/c/e2b54eaf28df0c978626c9736b94f003b523b451>

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

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