CVE-2025-68359: btrfs: fix double free of qgroup record after failure to add delayed ref head

Published Dec 24, 2025
·
Updated

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 adddelayedrefhead(). This could happen if the record was reported to already exist in the btrfsqgrouptraceextentnolock() call, but then there was an error later on adddelayedrefhead(). In this case, since adddelayedrefhead() returned an error, the caller went to free the record. Since adddelayedrefhead() 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 adddelayedrefhead(). 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 'qrecordinsertedret' boolean to account for this. Hence, the caller has to kfree the object only if adddelayedrefhead() reports not to have inserted it on the tracing logic.

As a side-effect of the above, we must guarantee that 'qrecordinsertedret' 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 'qrecordinsertedret' having an invalid value on an early exit.

The documentation from the adddelayedrefhead() has also been updated to reflect on the exact ownership of the 'qrecord' object.

Affected Software

1 affected component
linux/kernel

Event History

Dec 24, 2025
CVE Published
via MITRE·10:32 AM
Data Sourced
via MITRE·10:32 AM
DescriptionSeverity
Data Sourced
via NVD·11:15 AM
DescriptionSeverity
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-68359?

CVE-2025-68359 is considered a high-severity vulnerability due to its potential to cause a double free issue in the Linux kernel.

2

How do I fix CVE-2025-68359?

To fix CVE-2025-68359, update the Linux kernel to the patched version that addresses the double free issue.

3

Which applications are affected by CVE-2025-68359?

CVE-2025-68359 affects the Linux kernel, particularly scenarios involving the btrfs filesystem.

4

What can happen if CVE-2025-68359 is exploited?

If CVE-2025-68359 is exploited, it could lead to memory corruption and potential system crashes.

5

When was CVE-2025-68359 discovered?

CVE-2025-68359 was identified as an issue in the Linux kernel's handling of btrfs with regards to memory management.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203