{
  "id": "CVE-2025-68359",
  "url": "https://poc.griffinguard.io/cve/CVE-2025-68359",
  "published_at": "2025-12-24T10:32:48.456Z",
  "title": "btrfs: fix double free of qgroup record after failure to add delayed ref head",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 9.8,
    "source": "cna",
    "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  },
  "kev": {
    "in_kev": false,
    "added_at": null,
    "days_after_publication": null
  },
  "first_poc": null,
  "poc_repo_count": 0,
  "exploit_count": 0,
  "suspicious_repo_count": 0,
  "edge_device": null,
  "description": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix double free of qgroup record after failure to add delayed ref head\n\nIn the previous code it was possible to incur into a double kfree()\nscenario when calling add_delayed_ref_head(). This could happen if the\nrecord was reported to already exist in the\nbtrfs_qgroup_trace_extent_nolock() call, but then there was an error\nlater on add_delayed_ref_head(). In this case, since\nadd_delayed_ref_head() returned an error, the caller went to free the\nrecord. Since add_delayed_ref_head() couldn't set this kfree'd pointer\nto NULL, then kfree() would have acted on a non-NULL 'record' object\nwhich was pointing to memory already freed by the callee.\n\nThe problem comes from the fact that the responsibility to kfree the\nobject is on both the caller and the callee at the same time. Hence, the\nfix for this is to shift the ownership of the 'qrecord' object out of\nthe add_delayed_ref_head(). That is, we will never attempt to kfree()\nthe given object inside of this function, and will expect the caller to\nact on the 'qrecord' object on its own. The only exception where the\n'qrecord' object cannot be kfree'd is if it was inserted into the\ntracing logic, for which we already have the 'qrecord_inserted_ret'\nboolean to account for this. Hence, the caller has to kfree the object\nonly if add_delayed_ref_head() reports not to have inserted it on the\ntracing logic.\n\nAs a side-effect of the above, we must guarantee that\n'qrecord_inserted_ret' is properly initialized at the start of the\nfunction, not at the end, and then set when an actual insert\nhappens. This way we avoid 'qrecord_inserted_ret' having an invalid\nvalue on an early exit.\n\nThe documentation from the add_delayed_ref_head() has also been updated\nto reflect on the exact ownership of the 'qrecord' object.",
  "cvss_by_source": {
    "cna": 9.8
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, \u003c 82d46660ebd94c269e3f25a77eb563621d8e67e3",
          "\u003e= 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, \u003c 7617680769e3119dfb3b43a2b7c287ce2242211c",
          "\u003e= 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, \u003c 364685c4c2d9c9f4408d95451bcf42fdeebc3ebb",
          "\u003e= 6ef8fbce010421bf742b12b8f8f2b2d2ff154845, \u003c 725e46298876a2cc1f1c3fb22ba69d29102c3ddf"
        ],
        "fixed_in": [
          "82d46660ebd94c269e3f25a77eb563621d8e67e3",
          "7617680769e3119dfb3b43a2b7c287ce2242211c",
          "364685c4c2d9c9f4408d95451bcf42fdeebc3ebb",
          "725e46298876a2cc1f1c3fb22ba69d29102c3ddf"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "6.12"
        ],
        "fixed_in": [
          "0",
          "6.12.114",
          "6.17.13",
          "6.18.2",
          "6.19"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to 82d46660ebd94c269e3f25a77eb563621d8e67e3 or 7617680769e3119dfb3b43a2b7c287ce2242211c or 364685c4c2d9c9f4408d95451bcf42fdeebc3ebb or 725e46298876a2cc1f1c3fb22ba69d29102c3ddf or later.",
      "Upgrade Linux to 0 or 6.12.114 or 6.17.13 or 6.18.2 or 6.19 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
