# CVE-2025-71159: btrfs: fix use-after-free warning in btrfs_get_or_create_delayed_node()

- Severity: Critical 9.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.25%, higher than 17% of CVEs (2026-12-01)
- Published: 2026-01-23T15:23:57.824Z
- Modified: 2026-08-05T12:12:25.188Z
- Weaknesses: CWE-416
- Assigned by: Linux

## Description

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

btrfs: fix use-after-free warning in btrfs_get_or_create_delayed_node()

Previously, btrfs_get_or_create_delayed_node() set the delayed_node's
refcount before acquiring the root->delayed_nodes lock.
Commit e8513c012de7 ("btrfs: implement ref_tracker for delayed_nodes")
moved refcount_set inside the critical section, which means there is
no longer a memory barrier between setting the refcount and setting
btrfs_inode->delayed_node.

Without that barrier, the stores to node->refs and
btrfs_inode->delayed_node may become visible out of order. Another
thread can then read btrfs_inode->delayed_node and attempt to
increment a refcount that hasn't been set yet, leading to a
refcounting bug and a use-after-free warning.

The fix is to move refcount_set back to where it was to take
advantage of the implicit memory barrier provided by lock
acquisition.

Because the allocations now happen outside of the lock's critical
section, they can use GFP_NOFS instead of GFP_ATOMIC.

(As written by CVE List.)

## Affected

- Linux Linux: from e8513c012de75fd65e2df5499572bc6ef3f6e409 before c8385851a5435f4006281828d428e5d0b0bbf8af; from e8513c012de75fd65e2df5499572bc6ef3f6e409 before 83f59076a1ae6f5c6845d6f7ed3a1a373d883684; 6.18 (not affected: before 6.18; from 6.18.6 up to 6.18.*; from 6.19 up to *)
- linux linux_kernel: from 6.18 before 6.18.6; 6.19

## Every score

- Linux: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/c8385851a5435f4006281828d428e5d0b0bbf8af> (patch)
- <https://git.kernel.org/stable/c/83f59076a1ae6f5c6845d6f7ed3a1a373d883684> (patch)

## Sources

- CVE List: [CVE-2025-71159](https://www.cve.org/CVERecord?id=CVE-2025-71159), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2025-71159](https://nvd.nist.gov/vuln/detail/CVE-2025-71159), Public domain, modified 2026-07-30

---

Page: https://cve.day/CVE-2025-71159 · Whole record: https://cve.day/CVE-2025-71159.json · Rebuilt by cve.day 2026-11-25T22:59:10.841Z
