# CVE-2024-56582: btrfs: fix use-after-free in btrfs\_encoded\_read\_endio()

> 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-12-27T14:23:23.851Z
- **Modified:** 2026-06-17T08:12:28.167Z

## Who should check

- Anyone running Linux \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< a40de0330af4fb7bc6b354250c24f294f8b826a0; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< 6228f13f1996a4feb9b601d6644bf0bfe03671dd; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< f8a5129e4a9fc3f6aa3f137513253b51b31b94d4; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< 05b36b04d74a517d6675bf2f90829ff1ac7e28dc
- Anyone running Linux 5.18

## Description

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

btrfs: fix use-after-free in btrfs\_encoded\_read\_endio()

Shinichiro reported the following use-after free that sometimes is
happening in our CI system when running fstests' btrfs/284 on a TCMU
runner device:

  BUG: KASAN: slab-use-after-free in lock\_release+0x708/0x780
  Read of size 8 at addr ffff888106a83f18 by task kworker/u80:6/219

  CPU: 8 UID: 0 PID: 219 Comm: kworker/u80:6 Not tainted 6.12.0-rc6-kts+ \#15
  Hardware name: Supermicro Super Server/X11SPi-TF, BIOS 3.3 02/21/2020
  Workqueue: btrfs-endio btrfs\_end\_bio\_work \[btrfs\]
  Call Trace:
   \<TASK\>
   dump\_stack\_lvl+0x6e/0xa0
   ? lock\_release+0x708/0x780
   print\_report+0x174/0x505
   ? lock\_release+0x708/0x780
   ? \_\_virt\_addr\_valid+0x224/0x410
   ? lock\_release+0x708/0x780
   kasan\_report+0xda/0x1b0
   ? lock\_release+0x708/0x780
   ? \_\_wake\_up+0x44/0x60
   lock\_release+0x708/0x780
   ? \_\_pfx\_lock\_release+0x10/0x10
   ? \_\_pfx\_do\_raw\_spin\_lock+0x10/0x10
   ? lock\_is\_held\_type+0x9a/0x110
   \_raw\_spin\_unlock\_irqrestore+0x1f/0x60
   \_\_wake\_up+0x44/0x60
   btrfs\_encoded\_read\_endio+0x14b/0x190 \[btrfs\]
   btrfs\_check\_read\_bio+0x8d9/0x1360 \[btrfs\]
   ? lock\_release+0x1b0/0x780
   ? trace\_lock\_acquire+0x12f/0x1a0
   ? \_\_pfx\_btrfs\_check\_read\_bio+0x10/0x10 \[btrfs\]
   ? process\_one\_work+0x7e3/0x1460
   ? lock\_acquire+0x31/0xc0
   ? process\_one\_work+0x7e3/0x1460
   process\_one\_work+0x85c/0x1460
   ? \_\_pfx\_process\_one\_work+0x10/0x10
   ? assign\_work+0x16c/0x240
   worker\_thread+0x5e6/0xfc0
   ? \_\_pfx\_worker\_thread+0x10/0x10
   kthread+0x2c3/0x3a0
   ? \_\_pfx\_kthread+0x10/0x10
   ret\_from\_fork+0x31/0x70
   ? \_\_pfx\_kthread+0x10/0x10
   ret\_from\_fork\_asm+0x1a/0x30
   \</TASK\>

  Allocated by task 3661:
   kasan\_save\_stack+0x30/0x50
   kasan\_save\_track+0x14/0x30
   \_\_kasan\_kmalloc+0xaa/0xb0
   btrfs\_encoded\_read\_regular\_fill\_pages+0x16c/0x6d0 \[btrfs\]
   send\_extent\_data+0xf0f/0x24a0 \[btrfs\]
   process\_extent+0x48a/0x1830 \[btrfs\]
   changed\_cb+0x178b/0x2ea0 \[btrfs\]
   btrfs\_ioctl\_send+0x3bf9/0x5c20 \[btrfs\]
   \_btrfs\_ioctl\_send+0x117/0x330 \[btrfs\]
   btrfs\_ioctl+0x184a/0x60a0 \[btrfs\]
   \_\_x64\_sys\_ioctl+0x12e/0x1a0
   do\_syscall\_64+0x95/0x180
   entry\_SYSCALL\_64\_after\_hwframe+0x76/0x7e

  Freed by task 3661:
   kasan\_save\_stack+0x30/0x50
   kasan\_save\_track+0x14/0x30
   kasan\_save\_free\_info+0x3b/0x70
   \_\_kasan\_slab\_free+0x4f/0x70
   kfree+0x143/0x490
   btrfs\_encoded\_read\_regular\_fill\_pages+0x531/0x6d0 \[btrfs\]
   send\_extent\_data+0xf0f/0x24a0 \[btrfs\]
   process\_extent+0x48a/0x1830 \[btrfs\]
   changed\_cb+0x178b/0x2ea0 \[btrfs\]
   btrfs\_ioctl\_send+0x3bf9/0x5c20 \[btrfs\]
   \_btrfs\_ioctl\_send+0x117/0x330 \[btrfs\]
   btrfs\_ioctl+0x184a/0x60a0 \[btrfs\]
   \_\_x64\_sys\_ioctl+0x12e/0x1a0
   do\_syscall\_64+0x95/0x180
   entry\_SYSCALL\_64\_after\_hwframe+0x76/0x7e

  The buggy address belongs to the object at ffff888106a83f00
   which belongs to the cache kmalloc-rnd-07-96 of size 96
  The buggy address is located 24 bytes inside of
   freed 96-byte region \[ffff888106a83f00, ffff888106a83f60)

  The buggy address belongs to the physical page:
  page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888106a83800 pfn:0x106a83
  flags: 0x17ffffc0000000(node=0\|zone=2\|lastcpupid=0x1fffff)
  page\_type: f5(slab)
  raw: 0017ffffc0000000 ffff888100053680 ffffea0004917200 0000000000000004
  raw: ffff888106a83800 0000000080200019 00000001f5000000 0000000000000000
  page dumped because: kasan: bad access detected

  Memory state around the buggy address:
   ffff888106a83e00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
   ffff888106a83e80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
  \>ffff888106a83f00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                              ^
   ffff888106a83f80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
   ffff888106a84000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  ==================================================================

Further analyzing the trace and 
---truncated---

## Affected and fixed versions

- Linux: \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< a40de0330af4fb7bc6b354250c24f294f8b826a0; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< 6228f13f1996a4feb9b601d6644bf0bfe03671dd; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< f8a5129e4a9fc3f6aa3f137513253b51b31b94d4; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< 05b36b04d74a517d6675bf2f90829ff1ac7e28dc (cvelist)
- Linux: 5.18 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2024-56582.md
Affected: Linux >= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, < a40de0330af4fb7bc6b354250c24f294f8b826a0; >= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, < 6228f13f1996a4feb9b601d6644bf0bfe03671dd; >= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, < f8a5129e4a9fc3f6aa3f137513253b51b31b94d4; >= 1881fba89bd5dcd364d2e1b…
Fixed in: Linux 6228f13f1996a4feb9b601d6644bf0bfe03671dd, Linux 05b36b04d74a517d6675bf2f90829ff1ac7e28dc

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

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

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

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

Linux \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< a40de0330af4fb7bc6b354250c24f294f8b826a0; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< 6228f13f1996a4feb9b601d6644bf0bfe03671dd; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< f8a5129e4a9fc3f6aa3f137513253b51b31b94d4; \>= 1881fba89bd5dcd364d2e1bf561912a90a11c21a, \< 05b36b04d74a517d6675bf2f90829ff1ac7e28dc; Linux 5.18.

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

Yes. Fixed in Linux 6228f13f1996a4feb9b601d6644bf0bfe03671dd, Linux 05b36b04d74a517d6675bf2f90829ff1ac7e28dc. Upgrade Linux to 05b36b04d74a517d6675bf2f90829ff1ac7e28dc or later.

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

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/a40de0330af4fb7bc6b354250c24f294f8b826a0>
- patch: <https://git.kernel.org/stable/c/6228f13f1996a4feb9b601d6644bf0bfe03671dd>
- patch: <https://git.kernel.org/stable/c/f8a5129e4a9fc3f6aa3f137513253b51b31b94d4>
- patch: <https://git.kernel.org/stable/c/05b36b04d74a517d6675bf2f90829ff1ac7e28dc>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html>

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

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