CVE-2025-68359
btrfs: fix double free of qgroup record after failure to add delayed ref head
Check your servers for CVE-2025-68359
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-68359 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix double free of qgroup record after failure to add delayed ref head
In the previous code it was possible to incur into a double kfree() scenario when calling add_delayed_ref_head(). This could happen if the record was reported to already exist in the btrfs_qgroup_trace_extent_nolock() call, but then there was an error later on add_delayed_ref_head(). In this case, since add_delayed_ref_head() returned an error, the caller went to free the record. Since add_delayed_ref_head() couldn't set this kfree'd pointer to NULL, then kfree() would have acted on a non-NULL 'record' object which was pointing to memory already freed by the callee.
The problem comes from the fact that the responsibility to kfree the object is on both the caller and the callee at the same time. Hence, the fix for this is to shift the ownership of the 'qrecord' object out of the add_delayed_ref_head(). That is, we will never attempt to kfree() the given object inside of this function, and will expect the caller to act on the 'qrecord' object on its own. The only exception where the 'qrecord' object cannot be kfree'd is if it was inserted into the tracing logic, for which we already have the 'qrecord_inserted_ret' boolean to account for this. Hence, the caller has to kfree the object only if add_delayed_ref_head() reports not to have inserted it on the tracing logic.
As a side-effect of the above, we must guarantee that 'qrecord_inserted_ret' is properly initialized at the start of the function, not at the end, and then set when an actual insert happens. This way we avoid 'qrecord_inserted_ret' having an invalid value on an early exit.
The documentation from the add_delayed_ref_head() has also been updated to reflect on the exact ownership of the 'qrecord' object.
Severity (CVSS)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.67%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 53.2% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, before 82d46660ebd94c269e3f25a77eb563621d8e67e3 affected from 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, before 7617680769e3119dfb3b43a2b7c287ce2242211c affected from 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, before 364685c4c2d9c9f4408d95451bcf42fdeebc3ebb affected from 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, before 725e46298876a2cc1f1c3fb22ba69d29102c3ddf
Other versions: unaffected
|
| Linux |
affected 6.12 unaffected before 6.12 unaffected from 6.12.114 up to and including 6.12.* unaffected from 6.17.13 up to and including 6.17.* unaffected from 6.18.2 up to and including 6.18.* unaffected 6.19 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-68359 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-68359
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2025-68359
trivy image --scanners vuln IMAGE | grep CVE-2025-68359
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/82d46660ebd94c269e3f25a77eb563621d8e67e3 git.kernel.org
- https://git.kernel.org/stable/c/7617680769e3119dfb3b43a2b7c287ce2242211c git.kernel.org
- https://git.kernel.org/stable/c/364685c4c2d9c9f4408d95451bcf42fdeebc3ebb git.kernel.org
- https://git.kernel.org/stable/c/725e46298876a2cc1f1c3fb22ba69d29102c3ddf git.kernel.org
Source: the record CVE-2025-68359 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse