CVE-2025-68359
btrfs: fix double free of qgroup record after failure to add delayed ref head
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.
INFO
Published Date :
Dec. 24, 2025, 11:15 a.m.
Last Modified :
Oct. 21, 2026, 1:18 p.m.
Remotely Exploit :
Yes !
Source :
416baaa9-dc9f-4396-8d5f-8c081fb06d67
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS 3.1 | CRITICAL | 416baaa9-dc9f-4396-8d5f-8c081fb06d67 |
Solution
- Apply the kernel patch for btrfs double free.
- Ensure caller handles memory ownership correctly.
- Update documentation for memory management.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2025-68359.
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2025-68359 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2025-68359
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2025-68359 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2025-68359 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
CVE Modified by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
Oct. 21, 2026
Action Type Old Value New Value Added Affected Affected value modified. <a href="https://github.com/CVEProject/cvelistV5/blob/main/cves/2025/68xxx/CVE-2025-68359.json">CVE-2025-68359</a> Added Reference https://git.kernel.org/stable/c/364685c4c2d9c9f4408d95451bcf42fdeebc3ebb Added Reference https://git.kernel.org/stable/c/725e46298876a2cc1f1c3fb22ba69d29102c3ddf Added Reference https://git.kernel.org/stable/c/7617680769e3119dfb3b43a2b7c287ce2242211c Added Reference https://git.kernel.org/stable/c/82d46660ebd94c269e3f25a77eb563621d8e67e3 Removed Reference https://git.kernel.org/stable/c/364685c4c2d9c9f4408d95451bcf42fdeebc3ebb Removed Reference https://git.kernel.org/stable/c/725e46298876a2cc1f1c3fb22ba69d29102c3ddf Removed Reference https://git.kernel.org/stable/c/7617680769e3119dfb3b43a2b7c287ce2242211c -
CVE Translated by [email protected]
Oct. 14, 2026
Action Type Old Value New Value Added Translation Title: Linux, Description: En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: btrfs: corrige la doble liberación de un registro de qgroup después de fallar al añadir un 'delayed ref head' En el código anterior era posible incurrir en un escenario de doble kfree() al llamar a add_delayed_ref_head(). Esto podría ocurrir si se informaba que el registro ya existía en la llamada a btrfs_qgroup_trace_extent_nolock(), pero luego había un error más tarde en add_delayed_ref_head(). En este caso, dado que add_delayed_ref_head() devolvió un error, el llamador procedió a liberar el registro. Dado que add_delayed_ref_head() no pudo establecer este puntero 'kfree'd' a NULL, entonces kfree() habría actuado sobre un objeto 'record' no-NULL que apuntaba a memoria ya liberada por el llamado. El problema surge del hecho de que la responsabilidad de liberar el objeto con kfree recae tanto en el llamador como en el llamado al mismo tiempo. Por lo tanto, la solución para esto es trasladar la propiedad del objeto 'qrecord' fuera de add_delayed_ref_head(). Es decir, nunca intentaremos liberar con kfree() el objeto dado dentro de esta función, y esperaremos que el llamador actúe sobre el objeto 'qrecord' por su cuenta. La única excepción en la que el objeto 'qrecord' no puede ser liberado con kfree es si fue insertado en la lógica de rastreo, para lo cual ya tenemos el booleano 'qrecord_inserted_ret' que da cuenta de esto. Por lo tanto, el llamador tiene que liberar el objeto con kfree solo si add_delayed_ref_head() informa no haberlo insertado en la lógica de rastreo. Como efecto secundario de lo anterior, debemos garantizar que 'qrecord_inserted_ret' se inicialice correctamente al inicio de la función, no al final, y luego se establezca cuando ocurra una inserción real. De esta manera evitamos que 'qrecord_inserted_ret' tenga un valor inválido en una salida temprana. La documentación de add_delayed_ref_head() también ha sido actualizada para reflejar la propiedad exacta del objeto 'qrecord'. -
CVE Modified by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
Jul. 30, 2026
Action Type Old Value New Value Added CVSS V3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H -
CVE Modified by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
Jun. 17, 2026
Action Type Old Value New Value Added Affected [{'repo': 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git', 'vendor': 'Linux', 'product': 'Linux', 'versions': [{'status': 'affected', 'version': '6ef8fbce010421bf742b12b8f8f2b2d2ff154845', 'lessThan': '7617680769e3119dfb3b43a2b7c287ce2242211c', 'versionType': 'git'}, {'status': 'affected', 'version': '6ef8fbce010421bf742b12b8f8f2b2d2ff154845', 'lessThan': '364685c4c2d9c9f4408d95451bcf42fdeebc3ebb', 'versionType': 'git'}, {'status': 'affected', 'version': '6ef8fbce010421bf742b12b8f8f2b2d2ff154845', 'lessThan': '725e46298876a2cc1f1c3fb22ba69d29102c3ddf', 'versionType': 'git'}], 'programFiles': ['fs/btrfs/delayed-ref.c'], 'defaultStatus': 'unaffected'}, {'repo': 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git', 'vendor': 'Linux', 'product': 'Linux', 'versions': [{'status': 'affected', 'version': '6.12'}, {'status': 'unaffected', 'version': '0', 'lessThan': '6.12', 'versionType': 'semver'}, {'status': 'unaffected', 'version': '6.17.13', 'versionType': 'semver', 'lessThanOrEqual': '6.17.*'}, {'status': 'unaffected', 'version': '6.18.2', 'versionType': 'semver', 'lessThanOrEqual': '6.18.*'}, {'status': 'unaffected', 'version': '6.19', 'versionType': 'original_commit_for_fix', 'lessThanOrEqual': '*'}], 'programFiles': ['fs/btrfs/delayed-ref.c'], 'defaultStatus': 'affected'}] -
New CVE Received by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
Dec. 24, 2025
Action Type Old Value New Value Added 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. Added Reference https://git.kernel.org/stable/c/364685c4c2d9c9f4408d95451bcf42fdeebc3ebb Added Reference https://git.kernel.org/stable/c/725e46298876a2cc1f1c3fb22ba69d29102c3ddf Added Reference https://git.kernel.org/stable/c/7617680769e3119dfb3b43a2b7c287ce2242211c