CVE-2025-39759

Severity CVSS v4.0:
Pending analysis
Type:
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Publication date:
11/09/2025
Last modified:
09/01/2026

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> btrfs: qgroup: fix race between quota disable and quota rescan ioctl<br /> <br /> There&amp;#39;s a race between a task disabling quotas and another running the<br /> rescan ioctl that can result in a use-after-free of qgroup records from<br /> the fs_info-&gt;qgroup_tree rbtree.<br /> <br /> This happens as follows:<br /> <br /> 1) Task A enters btrfs_ioctl_quota_rescan() -&gt; btrfs_qgroup_rescan();<br /> <br /> 2) Task B enters btrfs_quota_disable() and calls<br /> btrfs_qgroup_wait_for_completion(), which does nothing because at that<br /> point fs_info-&gt;qgroup_rescan_running is false (it wasn&amp;#39;t set yet by<br /> task A);<br /> <br /> 3) Task B calls btrfs_free_qgroup_config() which starts freeing qgroups<br /> from fs_info-&gt;qgroup_tree without taking the lock fs_info-&gt;qgroup_lock;<br /> <br /> 4) Task A enters qgroup_rescan_zero_tracking() which starts iterating<br /> the fs_info-&gt;qgroup_tree tree while holding fs_info-&gt;qgroup_lock,<br /> but task B is freeing qgroup records from that tree without holding<br /> the lock, resulting in a use-after-free.<br /> <br /> Fix this by taking fs_info-&gt;qgroup_lock at btrfs_free_qgroup_config().<br /> Also at btrfs_qgroup_rescan() don&amp;#39;t start the rescan worker if quotas<br /> were already disabled.

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 3.12 (including) 6.1.149 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.2 (including) 6.6.103 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.7 (including) 6.12.44 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.13 (including) 6.15.11 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 6.16 (including) 6.16.2 (excluding)
cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*