Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvmet: Identify-Active Namespace ID List command should reject invalid nsid

nsid values of 0xFFFFFFFE and 0XFFFFFFFF should be rejected with
a status code of "Invalid Namespace or Format".
See NVMe Base Specification, Active Namespace ID list (CNS 02h).

Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Maurizio Lombardi and committed by
Keith Busch
899d2e5a 28982ad7

+10
+10
drivers/nvme/target/admin-cmd.c
··· 587 587 u16 status = 0; 588 588 int i = 0; 589 589 590 + /* 591 + * NSID values 0xFFFFFFFE and NVME_NSID_ALL are invalid 592 + * See NVMe Base Specification, Active Namespace ID list (CNS 02h). 593 + */ 594 + if (min_nsid == 0xFFFFFFFE || min_nsid == NVME_NSID_ALL) { 595 + req->error_loc = offsetof(struct nvme_identify, nsid); 596 + status = NVME_SC_INVALID_NS | NVME_STATUS_DNR; 597 + goto out; 598 + } 599 + 590 600 list = kzalloc(buf_size, GFP_KERNEL); 591 601 if (!list) { 592 602 status = NVME_SC_INTERNAL;