{
  "id": "CVE-2025-38658",
  "url": "https://poc.griffinguard.io/cve/CVE-2025-38658",
  "published_at": "2025-08-22T16:01:01.651Z",
  "title": "nvmet: pci-epf: Do not complete commands twice if nvmet_req_init() fails",
  "vendor": "Linux",
  "product": "Linux",
  "cvss": {
    "score": 8.8,
    "source": "cna",
    "vector": "CVSS:3.1/AV:A/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\nnvmet: pci-epf: Do not complete commands twice if nvmet_req_init() fails\n\nHave nvmet_req_init() and req-\u003eexecute() complete failed commands.\n\nDescription of the problem:\nnvmet_req_init() calls __nvmet_req_complete() internally upon failure,\ne.g., unsupported opcode, which calls the \"queue_response\" callback,\nthis results in nvmet_pci_epf_queue_response() being called, which will\ncall nvmet_pci_epf_complete_iod() if data_len is 0 or if dma_dir is\ndifferent from DMA_TO_DEVICE. This results in a double completion as\nnvmet_pci_epf_exec_iod_work() also calls nvmet_pci_epf_complete_iod()\nwhen nvmet_req_init() fails.\n\nSteps to reproduce:\nOn the host send a command with an unsupported opcode with nvme-cli,\nFor example the admin command \"security receive\"\n$ sudo nvme security-recv /dev/nvme0n1 -n1 -x4096\n\nThis triggers a double completion as nvmet_req_init() fails and\nnvmet_pci_epf_queue_response() is called, here iod-\u003edma_dir is still\nin the default state of \"DMA_NONE\" as set by default in\nnvmet_pci_epf_alloc_iod(), so nvmet_pci_epf_complete_iod() is called.\nBecause nvmet_req_init() failed nvmet_pci_epf_complete_iod() is also\ncalled in nvmet_pci_epf_exec_iod_work() leading to a double completion.\nThis not only sends two completions to the host but also corrupts the\nstate of the PCI NVMe target leading to kernel oops.\n\nThis patch lets nvmet_req_init() and req-\u003eexecute() complete all failed\ncommands, and removes the double completion case in\nnvmet_pci_epf_exec_iod_work() therefore fixing the edge cases where\ndouble completions occurred.",
  "cwe": "CWE-908",
  "cpes": [
    "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*"
  ],
  "cvss_by_source": {
    "cna": 8.8,
    "nvd": 5.5
  },
  "repos": [],
  "remediation": {
    "affected": [
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "\u003e= 0faa0fe6f90ea59b10d1b0f15ce0eb0c18eff186, \u003c a535c0b10060bc8c174a7964b0f98064ee0c4774",
          "\u003e= 0faa0fe6f90ea59b10d1b0f15ce0eb0c18eff186, \u003c 746d0ac5a07d5da952ef258dd4d75f0b26c96476"
        ],
        "fixed_in": [
          "a535c0b10060bc8c174a7964b0f98064ee0c4774",
          "746d0ac5a07d5da952ef258dd4d75f0b26c96476"
        ]
      },
      {
        "vendor": "Linux",
        "product": "Linux",
        "ranges": [
          "6.14"
        ],
        "fixed_in": [
          "0",
          "6.16.1",
          "6.17"
        ]
      }
    ],
    "upgrade": [
      "Upgrade Linux to a535c0b10060bc8c174a7964b0f98064ee0c4774 or 746d0ac5a07d5da952ef258dd4d75f0b26c96476 or later.",
      "Upgrade Linux to 0 or 6.16.1 or 6.17 or later."
    ]
  },
  "exploit_refs": [],
  "hunt_profile": [],
  "rules": []
}
