The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] nvmet-pci: validate endpoint queue IDs
@ 2026-07-10  2:30 Michael Bommarito
  2026-07-10  2:30 ` [PATCH 1/2] nvmet-pci: validate queue IDs against endpoint queues Michael Bommarito
  2026-07-10  2:30 ` [PATCH 2/2] nvmet-pci: add KUnit coverage for endpoint queue IDs Michael Bommarito
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Bommarito @ 2026-07-10  2:30 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni
  Cc: kwilczynski, Damien Le Moal, Manivannan Sadhasivam, Keith Busch,
	linux-nvme, linux-kernel, stable

A PCI root-complex host can crash an NVMe PCI endpoint target with
malformed queue IDs. The endpoint transport allocates its SQ/CQ arrays
using ctrl->nr_queues, which is capped by endpoint interrupt capacity,
but the common target admin validation only checks queue IDs against
subsys->max_qid. A host can therefore submit Create/Delete SQ/CQ commands
with qids that pass the common checks yet index past the smaller endpoint
transport arrays.

Patch 1 rejects queue IDs outside ctrl->nr_queues before the endpoint
SQ/CQ arrays are indexed. Patch 2 adds same-translation-unit KUnit/KASAN
coverage: a valid queue ID that must still be accepted and the
out-of-range Create/Delete SQ/CQ cases that must now be rejected.

Reproduced with the KUnit/KASAN test: the stock Create CQ path faults in
nvmet_pci_epf_create_cq() after nvmet_check_io_cqid() accepts qid 2 with
max_qid 8 and nr_queues 2; patched rejects the malformed cases while the
benign control still passes.

Cc: stable@vger.kernel.org

Michael Bommarito (2):
  nvmet-pci: validate queue IDs against endpoint queues
  nvmet-pci: add KUnit coverage for endpoint queue IDs

 drivers/nvme/target/Kconfig   |  11 +++
 drivers/nvme/target/pci-epf.c | 151 ++++++++++++++++++++++++++++++++--
 2 files changed, 157 insertions(+), 5 deletions(-)

--
2.53.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-10  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10  2:30 [PATCH 0/2] nvmet-pci: validate endpoint queue IDs Michael Bommarito
2026-07-10  2:30 ` [PATCH 1/2] nvmet-pci: validate queue IDs against endpoint queues Michael Bommarito
2026-07-10  3:27   ` Damien Le Moal
2026-07-10  2:30 ` [PATCH 2/2] nvmet-pci: add KUnit coverage for endpoint queue IDs Michael Bommarito
2026-07-10  3:29   ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox