# CVE-2025-39759: btrfs: qgroup: fix race between quota disable and quota rescan ioctl

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

- **Severity:** HIGH 7.0
- **CVSS:** 7.0 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; 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.16% (percentile 3, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-09-11T16:52:28.314Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< 7cda0fdde5d9890976861421d207870500f9aace; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< b172535ccba12f0cf7d23b3b840989de47fc104d; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< dd0b28d877b293b1d7f8727a7de08ae36b6b9ef0; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< c38028ce0d0045ca600b6a8345a0ff92bfb47b66; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< 2fd0f5ceb997f90f4332ccbab6c7e907e6b2d0eb; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< e1249667750399a48cafcf5945761d39fa584edf
- Anyone running Linux 3.12

## Description

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

btrfs: qgroup: fix race between quota disable and quota rescan ioctl

There's a race between a task disabling quotas and another running the
rescan ioctl that can result in a use-after-free of qgroup records from
the fs\_info-\>qgroup\_tree rbtree.

This happens as follows:

1) Task A enters btrfs\_ioctl\_quota\_rescan() -\> btrfs\_qgroup\_rescan();

2) Task B enters btrfs\_quota\_disable() and calls
   btrfs\_qgroup\_wait\_for\_completion(), which does nothing because at that
   point fs\_info-\>qgroup\_rescan\_running is false (it wasn't set yet by
   task A);

3) Task B calls btrfs\_free\_qgroup\_config() which starts freeing qgroups
   from fs\_info-\>qgroup\_tree without taking the lock fs\_info-\>qgroup\_lock;

4) Task A enters qgroup\_rescan\_zero\_tracking() which starts iterating
   the fs\_info-\>qgroup\_tree tree while holding fs\_info-\>qgroup\_lock,
   but task B is freeing qgroup records from that tree without holding
   the lock, resulting in a use-after-free.

Fix this by taking fs\_info-\>qgroup\_lock at btrfs\_free\_qgroup\_config().
Also at btrfs\_qgroup\_rescan() don't start the rescan worker if quotas
were already disabled.

## Affected and fixed versions

- Linux: \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< 7cda0fdde5d9890976861421d207870500f9aace; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< b172535ccba12f0cf7d23b3b840989de47fc104d; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< dd0b28d877b293b1d7f8727a7de08ae36b6b9ef0; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< c38028ce0d0045ca600b6a8345a0ff92bfb47b66; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< 2fd0f5ceb997f90f4332ccbab6c7e907e6b2d0eb; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< e1249667750399a48cafcf5945761d39fa584edf (cvelist)
- Linux: 3.12 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-39759.md
Affected: Linux >= e685da14af6b31e4b336a110cb1bae1afc268be8, < 7cda0fdde5d9890976861421d207870500f9aace; >= e685da14af6b31e4b336a110cb1bae1afc268be8, < b172535ccba12f0cf7d23b3b840989de47fc104d; >= e685da14af6b31e4b336a110cb1bae1afc268be8, < dd0b28d877b293b1d7f8727a7de08ae36b6b9ef0; >= e685da14af6b31e4b336a11…
Fixed in: Linux 7cda0fdde5d9890976861421d207870500f9aace, Linux 2fd0f5ceb997f90f4332ccbab6c7e907e6b2d0eb

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-2025-39759 being exploited?

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

### How serious is CVE-2025-39759?

High: CVSS 7.0 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2025-39759?

Linux \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< 7cda0fdde5d9890976861421d207870500f9aace; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< b172535ccba12f0cf7d23b3b840989de47fc104d; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< dd0b28d877b293b1d7f8727a7de08ae36b6b9ef0; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< c38028ce0d0045ca600b6a8345a0ff92bfb47b66; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< 2fd0f5ceb997f90f4332ccbab6c7e907e6b2d0eb; \>= e685da14af6b31e4b336a110cb1bae1afc268be8, \< e1249667750399a48cafcf5945761d39fa584edf; Linux 3.12.

### Is there a fix for CVE-2025-39759?

Yes. Fixed in Linux 7cda0fdde5d9890976861421d207870500f9aace, Linux 2fd0f5ceb997f90f4332ccbab6c7e907e6b2d0eb. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2025-39759?

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/7cda0fdde5d9890976861421d207870500f9aace>
- patch: <https://git.kernel.org/stable/c/b172535ccba12f0cf7d23b3b840989de47fc104d>
- patch: <https://git.kernel.org/stable/c/dd0b28d877b293b1d7f8727a7de08ae36b6b9ef0>
- patch: <https://git.kernel.org/stable/c/c38028ce0d0045ca600b6a8345a0ff92bfb47b66>
- patch: <https://git.kernel.org/stable/c/2fd0f5ceb997f90f4332ccbab6c7e907e6b2d0eb>
- patch: <https://git.kernel.org/stable/c/e1249667750399a48cafcf5945761d39fa584edf>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-032379.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-2025-39759>

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