Commit 899d2e5a authored by Maurizio Lombardi's avatar Maurizio Lombardi Committed by Keith Busch

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: a07b4970 ("nvmet: add a generic NVMe target")
Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent 28982ad7
......@@ -587,6 +587,16 @@ static void nvmet_execute_identify_nslist(struct nvmet_req *req)
u16 status = 0;
int i = 0;
/*
* NSID values 0xFFFFFFFE and NVME_NSID_ALL are invalid
* See NVMe Base Specification, Active Namespace ID list (CNS 02h).
*/
if (min_nsid == 0xFFFFFFFE || min_nsid == NVME_NSID_ALL) {
req->error_loc = offsetof(struct nvme_identify, nsid);
status = NVME_SC_INVALID_NS | NVME_STATUS_DNR;
goto out;
}
list = kzalloc(buf_size, GFP_KERNEL);
if (!list) {
status = NVME_SC_INTERNAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment