# CVE-2022-50571: btrfs: call \_\_btrfs\_remove\_free\_space\_cache\_locked on cache load failure

> 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.26% (percentile 11, 2026-11-26)
- **Published:** 2025-10-22T13:23:27.187Z
- **Modified:** 2026-06-17T05:23:48.800Z

## Who should check

- Anyone running Linux \>= cd79909bc7cdd8043a22d699aae1e8435792c824, \< 819a61301275dcc573e3f520be3dc2c8531bee2d; \>= cd79909bc7cdd8043a22d699aae1e8435792c824, \< 8a1ae2781dee9fc21ca82db682d37bea4bd074ad
- Anyone running Linux 5.11

## Description

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

btrfs: call \_\_btrfs\_remove\_free\_space\_cache\_locked on cache load failure

Now that lockdep is staying enabled through our entire CI runs I started
seeing the following stack in generic/475

------------\[ cut here \]------------
WARNING: CPU: 1 PID: 2171864 at fs/btrfs/discard.c:604 btrfs\_discard\_update\_discardable+0x98/0xb0
CPU: 1 PID: 2171864 Comm: kworker/u4:0 Not tainted 5.19.0-rc8+ \#789
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
Workqueue: btrfs-cache btrfs\_work\_helper
RIP: 0010:btrfs\_discard\_update\_discardable+0x98/0xb0
RSP: 0018:ffffb857c2f7bad0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8c85c605c200 RCX: 0000000000000001
RDX: 0000000000000000 RSI: ffffffff86807c5b RDI: ffffffff868a831e
RBP: ffff8c85c4c54000 R08: 0000000000000000 R09: 0000000000000000
R10: ffff8c85c66932f0 R11: 0000000000000001 R12: ffff8c85c3899010
R13: ffff8c85d5be4f40 R14: ffff8c85c4c54000 R15: ffff8c86114bfa80
FS:  0000000000000000(0000) GS:ffff8c863bd00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2e7f168160 CR3: 000000010289a004 CR4: 0000000000370ee0
Call Trace:

 \_\_btrfs\_remove\_free\_space\_cache+0x27/0x30
 load\_free\_space\_cache+0xad2/0xaf0
 caching\_thread+0x40b/0x650
 ? lock\_release+0x137/0x2d0
 btrfs\_work\_helper+0xf2/0x3e0
 ? lock\_is\_held\_type+0xe2/0x140
 process\_one\_work+0x271/0x590
 ? process\_one\_work+0x590/0x590
 worker\_thread+0x52/0x3b0
 ? process\_one\_work+0x590/0x590
 kthread+0xf0/0x120
 ? kthread\_complete\_and\_exit+0x20/0x20
 ret\_from\_fork+0x1f/0x30

This is the code

        ctl = block\_group-\>free\_space\_ctl;
        discard\_ctl = &block\_group-\>fs\_info-\>discard\_ctl;

        lockdep\_assert\_held(&ctl-\>tree\_lock);

We have a temporary free space ctl for loading the free space cache in
order to avoid having allocations happening while we're loading the
cache.  When we hit an error we free it all up, however this also calls
btrfs\_discard\_update\_discardable, which requires
block\_group-\>free\_space\_ctl-\>tree\_lock to be held.  However this is our
temporary ctl so this lock isn't held.  Fix this by calling
\_\_btrfs\_remove\_free\_space\_cache\_locked instead so that we only clean up
the entries and do not mess with the discardable stats.

## Affected and fixed versions

- Linux: \>= cd79909bc7cdd8043a22d699aae1e8435792c824, \< 819a61301275dcc573e3f520be3dc2c8531bee2d; \>= cd79909bc7cdd8043a22d699aae1e8435792c824, \< 8a1ae2781dee9fc21ca82db682d37bea4bd074ad (cvelist)
- Linux: 5.11 (cvelist)

## Mitigation

- Upgrade Linux to 8a1ae2781dee9fc21ca82db682d37bea4bd074ad or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2022-50571.md
Affected: Linux >= cd79909bc7cdd8043a22d699aae1e8435792c824, < 819a61301275dcc573e3f520be3dc2c8531bee2d; >= cd79909bc7cdd8043a22d699aae1e8435792c824, < 8a1ae2781dee9fc21ca82db682d37bea4bd074ad; Linux 5.11
Fixed in: Linux 819a61301275dcc573e3f520be3dc2c8531bee2d, Linux 8a1ae2781dee9fc21ca82db682d37bea4bd074ad

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-2022-50571 being exploited?

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

### How serious is CVE-2022-50571?

It has no CVSS score yet. Unknown.

### Which versions are affected by CVE-2022-50571?

Linux \>= cd79909bc7cdd8043a22d699aae1e8435792c824, \< 819a61301275dcc573e3f520be3dc2c8531bee2d; \>= cd79909bc7cdd8043a22d699aae1e8435792c824, \< 8a1ae2781dee9fc21ca82db682d37bea4bd074ad; Linux 5.11.

### Is there a fix for CVE-2022-50571?

Yes. Fixed in Linux 819a61301275dcc573e3f520be3dc2c8531bee2d, Linux 8a1ae2781dee9fc21ca82db682d37bea4bd074ad. Upgrade Linux to 8a1ae2781dee9fc21ca82db682d37bea4bd074ad or later.

### How do I check if I'm affected by CVE-2022-50571?

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/819a61301275dcc573e3f520be3dc2c8531bee2d>
- other: <https://git.kernel.org/stable/c/8a1ae2781dee9fc21ca82db682d37bea4bd074ad>

## 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-2022-50571>

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