CVE-2025-38658

Source
https://cve.org/CVERecord?id=CVE-2025-38658
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-38658.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-38658
Downstream
Related
Published
2025-08-22T16:01:01.651Z
Modified
2026-03-23T05:00:51.103946957Z
Summary
nvmet: pci-epf: Do not complete commands twice if nvmet_req_init() fails
Details

In the Linux kernel, the following vulnerability has been resolved:

nvmet: pci-epf: Do not complete commands twice if nvmetreqinit() fails

Have nvmetreqinit() and req->execute() complete failed commands.

Description of the problem: nvmetreqinit() calls __nvmetreqcomplete() internally upon failure, e.g., unsupported opcode, which calls the "queueresponse" callback, this results in nvmetpciepfqueueresponse() being called, which will call nvmetpciepfcompleteiod() if datalen is 0 or if dmadir is different from DMATODEVICE. This results in a double completion as nvmetpciepfexeciodwork() also calls nvmetpciepfcompleteiod() when nvmetreqinit() fails.

Steps to reproduce: On the host send a command with an unsupported opcode with nvme-cli, For example the admin command "security receive" $ sudo nvme security-recv /dev/nvme0n1 -n1 -x4096

This triggers a double completion as nvmetreqinit() fails and nvmetpciepfqueueresponse() is called, here iod->dmadir is still in the default state of "DMANONE" as set by default in nvmetpciepfallociod(), so nvmetpciepfcompleteiod() is called. Because nvmetreqinit() failed nvmetpciepfcompleteiod() is also called in nvmetpciepfexeciod_work() leading to a double completion. This not only sends two completions to the host but also corrupts the state of the PCI NVMe target leading to kernel oops.

This patch lets nvmetreqinit() and req->execute() complete all failed commands, and removes the double completion case in nvmetpciepfexeciod_work() therefore fixing the edge cases where double completions occurred.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/38xxx/CVE-2025-38658.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0faa0fe6f90ea59b10d1b0f15ce0eb0c18eff186
Fixed
a535c0b10060bc8c174a7964b0f98064ee0c4774
Fixed
746d0ac5a07d5da952ef258dd4d75f0b26c96476

Affected versions

v6.*
v6.13
v6.13-rc5
v6.13-rc6
v6.13-rc7
v6.14
v6.14-rc1
v6.14-rc2
v6.14-rc3
v6.14-rc4
v6.14-rc5
v6.14-rc6
v6.14-rc7
v6.15
v6.15-rc1
v6.15-rc2
v6.15-rc3
v6.15-rc4
v6.15-rc5
v6.15-rc6
v6.15-rc7
v6.16
v6.16-rc1
v6.16-rc2
v6.16-rc3
v6.16-rc4
v6.16-rc5
v6.16-rc6
v6.16-rc7

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-38658.json"