Linux hwe edge: 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… (CVE-2025-68359)
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.
AI Analysis
Technical Summary
CVE-2025-68359 addresses a double free vulnerability in the Linux kernel's Btrfs filesystem related to the handling of qgroup record objects in the add_delayed_ref_head() function. Previously, both the caller and callee could free the same memory, causing a double kfree() on the qgroup record if an error occurred after detecting an existing record. The patch shifts ownership responsibility solely to the caller, preventing the callee from freeing the object. Additionally, it ensures the 'qrecord_inserted_ret' flag is correctly initialized to avoid invalid states on early function exit. This resolves the risk of kernel memory corruption and potential denial of service.
Potential Impact
The vulnerability can lead to kernel memory corruption through a double free condition, which may cause system instability, crashes, or potential escalation of privilege if exploited. The CVSS vector indicates network attack vector with no privileges or user interaction required, and high impact on confidentiality, integrity, and availability, classifying it as critical.
Mitigation Recommendations
A fix is available that changes the ownership model of the qgroup record object in the add_delayed_ref_head() function to prevent double freeing. Users should apply the official Linux kernel patches that address this issue. Since this is a kernel vulnerability, updating to a patched kernel version is the recommended remediation. Patch status is not explicitly provided here; check the official Linux kernel advisories or vendor updates for the exact fixed versions and apply them promptly.
Linux hwe edge: 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… (CVE-2025-68359)
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.
CVSS v3.1
Score 9.8critical
Affected software
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2025-68359 addresses a double free vulnerability in the Linux kernel's Btrfs filesystem related to the handling of qgroup record objects in the add_delayed_ref_head() function. Previously, both the caller and callee could free the same memory, causing a double kfree() on the qgroup record if an error occurred after detecting an existing record. The patch shifts ownership responsibility solely to the caller, preventing the callee from freeing the object. Additionally, it ensures the 'qrecord_inserted_ret' flag is correctly initialized to avoid invalid states on early function exit. This resolves the risk of kernel memory corruption and potential denial of service.
Potential Impact
The vulnerability can lead to kernel memory corruption through a double free condition, which may cause system instability, crashes, or potential escalation of privilege if exploited. The CVSS vector indicates network attack vector with no privileges or user interaction required, and high impact on confidentiality, integrity, and availability, classifying it as critical.
Mitigation Recommendations
A fix is available that changes the ownership model of the qgroup record object in the add_delayed_ref_head() function to prevent double freeing. Users should apply the official Linux kernel patches that address this issue. Since this is a kernel vulnerability, updating to a patched kernel version is the recommended remediation. Patch status is not explicitly provided here; check the official Linux kernel advisories or vendor updates for the exact fixed versions and apply them promptly.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-wmvq-g95c-rpvj
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2025-68359"]
- Database Specific Severity
- CRITICAL
- Cvss Version
- 3.1
Threat ID: 6a6b72d29c2644c7f847796d
Added to database: 07/30/2026, 15:50:42 UTC
Last enriched: 07/30/2026, 18:57:08 UTC
Last updated: 09/10/2026, 19:36:51 UTC
Views: 10
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.