# CVE-2022-49702: btrfs: fix hang during unmount when block group reclaim task is running

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

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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.21% (percentile 7, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2025-02-26T02:24:22.030Z
- **Modified:** 2026-06-17T05:18:54.503Z

## Who should check

- Anyone running Linux \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 341d33128a940c6634175dcb6ca92dc454cfa7d2; \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 9fadb11f1295289e0da4d3342ecb6b92c1c99540; \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 31e70e527806c546a72262f2fc3d982ee23c42d3
- Anyone running Linux 5.13

## Description

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

btrfs: fix hang during unmount when block group reclaim task is running

When we start an unmount, at close\_ctree(), if we have the reclaim task
running and in the middle of a data block group relocation, we can trigger
a deadlock when stopping an async reclaim task, producing a trace like the
following:

\[629724.498185\] task:kworker/u16:7   state:D stack:    0 pid:681170 ppid:     2 flags:0x00004000
\[629724.499760\] Workqueue: events\_unbound btrfs\_async\_reclaim\_metadata\_space \[btrfs\]
\[629724.501267\] Call Trace:
\[629724.501759\]  \<TASK\>
\[629724.502174\]  \_\_schedule+0x3cb/0xed0
\[629724.502842\]  schedule+0x4e/0xb0
\[629724.503447\]  btrfs\_wait\_on\_delayed\_iputs+0x7c/0xc0 \[btrfs\]
\[629724.504534\]  ? prepare\_to\_wait\_exclusive+0xc0/0xc0
\[629724.505442\]  flush\_space+0x423/0x630 \[btrfs\]
\[629724.506296\]  ? rcu\_read\_unlock\_trace\_special+0x20/0x50
\[629724.507259\]  ? lock\_release+0x220/0x4a0
\[629724.507932\]  ? btrfs\_get\_alloc\_profile+0xb3/0x290 \[btrfs\]
\[629724.508940\]  ? do\_raw\_spin\_unlock+0x4b/0xa0
\[629724.509688\]  btrfs\_async\_reclaim\_metadata\_space+0x139/0x320 \[btrfs\]
\[629724.510922\]  process\_one\_work+0x252/0x5a0
\[629724.511694\]  ? process\_one\_work+0x5a0/0x5a0
\[629724.512508\]  worker\_thread+0x52/0x3b0
\[629724.513220\]  ? process\_one\_work+0x5a0/0x5a0
\[629724.514021\]  kthread+0xf2/0x120
\[629724.514627\]  ? kthread\_complete\_and\_exit+0x20/0x20
\[629724.515526\]  ret\_from\_fork+0x22/0x30
\[629724.516236\]  \</TASK\>
\[629724.516694\] task:umount          state:D stack:    0 pid:719055 ppid:695412 flags:0x00004000
\[629724.518269\] Call Trace:
\[629724.518746\]  \<TASK\>
\[629724.519160\]  \_\_schedule+0x3cb/0xed0
\[629724.519835\]  schedule+0x4e/0xb0
\[629724.520467\]  schedule\_timeout+0xed/0x130
\[629724.521221\]  ? lock\_release+0x220/0x4a0
\[629724.521946\]  ? lock\_acquired+0x19c/0x420
\[629724.522662\]  ? trace\_hardirqs\_on+0x1b/0xe0
\[629724.523411\]  \_\_wait\_for\_common+0xaf/0x1f0
\[629724.524189\]  ? usleep\_range\_state+0xb0/0xb0
\[629724.524997\]  \_\_flush\_work+0x26d/0x530
\[629724.525698\]  ? flush\_workqueue\_prep\_pwqs+0x140/0x140
\[629724.526580\]  ? lock\_acquire+0x1a0/0x310
\[629724.527324\]  \_\_cancel\_work\_timer+0x137/0x1c0
\[629724.528190\]  close\_ctree+0xfd/0x531 \[btrfs\]
\[629724.529000\]  ? evict\_inodes+0x166/0x1c0
\[629724.529510\]  generic\_shutdown\_super+0x74/0x120
\[629724.530103\]  kill\_anon\_super+0x14/0x30
\[629724.530611\]  btrfs\_kill\_super+0x12/0x20 \[btrfs\]
\[629724.531246\]  deactivate\_locked\_super+0x31/0xa0
\[629724.531817\]  cleanup\_mnt+0x147/0x1c0
\[629724.532319\]  task\_work\_run+0x5c/0xa0
\[629724.532984\]  exit\_to\_user\_mode\_prepare+0x1a6/0x1b0
\[629724.533598\]  syscall\_exit\_to\_user\_mode+0x16/0x40
\[629724.534200\]  do\_syscall\_64+0x48/0x90
\[629724.534667\]  entry\_SYSCALL\_64\_after\_hwframe+0x44/0xae
\[629724.535318\] RIP: 0033:0x7fa2b90437a7
\[629724.535804\] RSP: 002b:00007ffe0b7e4458 EFLAGS: 00000246 ORIG\_RAX: 00000000000000a6
\[629724.536912\] RAX: 0000000000000000 RBX: 00007fa2b9182264 RCX: 00007fa2b90437a7
\[629724.538156\] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000555d6cf20dd0
\[629724.539053\] RBP: 0000555d6cf20ba0 R08: 0000000000000000 R09: 00007ffe0b7e3200
\[629724.539956\] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
\[629724.540883\] R13: 0000555d6cf20dd0 R14: 0000555d6cf20cb0 R15: 0000000000000000
\[629724.541796\]  \</TASK\>

This happens because:

1) Before entering close\_ctree() we have the async block group reclaim
   task running and relocating a data block group;

2) There's an async metadata (or data) space reclaim task running;

3) We enter close\_ctree() and park the cleaner kthread;

4) The async space reclaim task is at flush\_space() and runs all the
   existing delayed iputs;

5) Before the async space reclaim task calls
   btrfs\_wait\_on\_delayed\_iputs(), the block group reclaim task which is
   doing the data block group relocation, creates a delayed iput at
   replace\_file\_extents() (called when COWing leaves that have file extent
   items pointing to relocated data exten
---truncated---

## Affected and fixed versions

- Linux: \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 341d33128a940c6634175dcb6ca92dc454cfa7d2; \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 9fadb11f1295289e0da4d3342ecb6b92c1c99540; \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 31e70e527806c546a72262f2fc3d982ee23c42d3 (cvelist)
- Linux: 5.13 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2022-49702.md
Affected: Linux >= 18bb8bbf13c1839b43c9e09e76d397b753989af2, < 341d33128a940c6634175dcb6ca92dc454cfa7d2; >= 18bb8bbf13c1839b43c9e09e76d397b753989af2, < 9fadb11f1295289e0da4d3342ecb6b92c1c99540; >= 18bb8bbf13c1839b43c9e09e76d397b753989af2, < 31e70e527806c546a72262f2fc3d982ee23c42d3; Linux 5.13
Fixed in: Linux 341d33128a940c6634175dcb6ca92dc454cfa7d2, Linux 9fadb11f1295289e0da4d3342ecb6b92c1c99540, Linux 31e70e527806c546a72262f2fc3d982ee23c42d3

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

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

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

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 341d33128a940c6634175dcb6ca92dc454cfa7d2; \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 9fadb11f1295289e0da4d3342ecb6b92c1c99540; \>= 18bb8bbf13c1839b43c9e09e76d397b753989af2, \< 31e70e527806c546a72262f2fc3d982ee23c42d3; Linux 5.13.

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

Yes. Fixed in Linux 341d33128a940c6634175dcb6ca92dc454cfa7d2, Linux 9fadb11f1295289e0da4d3342ecb6b92c1c99540, Linux 31e70e527806c546a72262f2fc3d982ee23c42d3. Upgrade Linux to 31e70e527806c546a72262f2fc3d982ee23c42d3 or later.

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

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/341d33128a940c6634175dcb6ca92dc454cfa7d2>
- patch: <https://git.kernel.org/stable/c/9fadb11f1295289e0da4d3342ecb6b92c1c99540>
- patch: <https://git.kernel.org/stable/c/31e70e527806c546a72262f2fc3d982ee23c42d3>

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

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