Look up another CVE · open CVE-2025-68359 in the interactive tracker
CVE-2025-68359
btrfs: fix double free of qgroup record after failure to add delayed ref head
Published 2025-12-24 (10 months ago) by the Linux kernel CNA. Subsystem fs/btrfs. Debian urgency: unimportant.
What to do, per Debian release
Debian's own status for CVE-2025-68359 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source
| Release | Status | Version | What this means |
|---|---|---|---|
| Debian 12bookworm | not affected | 6.1.190-1 | Nothing to do. bookworm never shipped the vulnerable code. |
| Debian 13trixie | vulnerable | 6.12.113-1 | No fix published anywhere yet, neither in Debian nor upstream for the series trixie tracks. Watch the Debian tracker page for this CVE. Advisories for trixie have historically landed a median of 11 days after publication. |
| Debian 14forky | fixed | 6.17.13-1 | Update the kernel and reboot. Fixed in 6.17.13-1. A running kernel keeps the old code until the machine restarts. |
| Debian unstablesid | fixed | 6.17.13-1 | Update the kernel and reboot. Fixed in 6.17.13-1. A running kernel keeps the old code until the machine restarts. |
The vulnerability
What the bug is
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.
Where it lives
The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.
fs/btrfs/delayed-ref.c
- What this is
- BTRFS FILE SYSTEMMAINTAINERS section matched on fs/btrfs/ · linux-btrfs@vger.kernel.org · Maintained
- Kernel module
- btrfs
Check it on the machine
grep -w CONFIG_BTRFS_FS /boot/config-$(uname -r)Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.
lsmod | grep -w btrfsPrints a line if that module is loaded right now, and nothing if it is not. One that is not loaded can still be loaded later by anything that needs it.
Show whether Debian builds this, per release
Debian builds this as a loadable module. Every release below compiles it as a module on every flavour, so whether the code is in the running kernel depends on whether that module is loaded.
- bookworm, trixie, forky, sidm
- m
- a loadable module on every flavour - check lsmod, can be blacklisted
- Build switch
- CONFIG_BTRFS_FS
From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages
Signals
- Published
- 2025-12-24 (10 months ago)source
- CVSS
- 9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:Hsource recompute it - Attack vector
- network (AV:N)source
- EPSS
- 0.53%, higher than 43.6% of all CVEssource
- CISA KEV
- not listedthe KEV catalogue
- Debian urgency
- unimportantsource
- Subsystem
- fs/btrfs
Upstream fixes
The versions the CNA records as introducing and fixing this, and the commit for each. source
| Introduced | Fixed in | Commit |
|---|---|---|
| 6.12 | 6.17.13 | 7617680769e3 |
| 6.12 | 6.18.2 | 364685c4c2d9 |
| 6.12 | 6.19 | 725e46298876 |
Why the CNA scored it this way
Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source
- AV:NAttack vector, network
- NFSv4.2 DEALLOCATE and ksmbd FSCTL_SET_ZERO_DATA can remotely invoke hole punching on exported Btrfs files, reaching the vulnerable delayed-reference path.
- AC:LAttack complexity, low
- An attacker can repeatedly manipulate shared extents, issue concurrent deallocations, and drive delayed-reference processing and memory pressure; both sides of the required race are attacker-influenceable.
- PR:NPrivileges required, none
- An anonymous writable NFS export or writable ksmbd guest share permits the required operations without credentials or kernel capabilities.
- UI:NUser interaction, none
- Once qgroup accounting and the writable export are configured, exploitation requires no action by another user.
- S:UScope, unchanged
- The corruption compromises the same host-kernel security authority and does not cross a virtualization or other security-scope boundary.
- C:HConfidentiality impact, high
- The double free can corrupt the slab freelist and produce overlapping allocations, enabling kernel-memory disclosure and arbitrary reads.
- I:HIntegrity impact, high
- Freelist corruption and overlapping allocations can provide attacker-controlled kernel writes and control-flow hijacking.
- A:HAvailability impact, high
- Freelist hardening can immediately trigger a BUG, while unhardened allocators suffer freelist corruption that can crash or panic the kernel repeatedly.