Skip to contentSkip to conversation

nvmet: return Invalid Field error on set features cmd fid 07h

PATCH In review [email protected] 3 participants 4 messages Feb 28, 2020 – Mar 1, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: return Invalid Field error on set features cmd fid 07h

From: Amit Engel <[email protected]>

If the value specified in NCQR and NSQR fields (0's based) is 65,535 the controller should return an error of Invalid field in command

---
 drivers/nvme/target/admin-cmd.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nvme/target/admin-cmd.c +7 -0
index 19f949570625..94b0ac923e99 100644
@@ -733,6 +733,9 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
 {
 	struct nvmet_subsys *subsys = req->sq->ctrl->subsys;
 	u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
+	u32 cdw11 = le32_to_cpu(req->cmd->common.cdw11);
+	u16 ncqr = (cdw11 >> 16) & 0xffff;
+	u16 nsqr = cdw11 & 0xffff;
 	u16 status = 0;
 
 	if (!nvmet_check_data_len(req, 0))
@@ -740,6 +743,10 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
 
 	switch (cdw10 & 0xff) {
 	case NVME_FEAT_NUM_QUEUES:
+		if (ncqr == 0xffff || nsqr == 0xffff) {
+			status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
+			break;
+		}
 		nvmet_set_result(req,
 			(subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16));
 		break;
Signature · 7 lines
2.16.5


_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
maintainer
#1 lore raw
Quoted 16 lines

From: Amit Engel <[email protected]>

If the value specified in NCQR and NSQR fields (0's based) is 65,535 the controller should return an error of Invalid field in command

---
  drivers/nvme/target/admin-cmd.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/nvme/target/admin-cmd.c +0 -0
index 19f949570625..94b0ac923e99 100644

drivers/nvme/target/admin-cmd.c static void nvmet_execute_set_features(struct nvmet_req *req) · line 738

Quoted 6 lines
drivers/nvme/target/admin-cmd.c +3 -0
@@ -733,6 +733,9 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
  {
  	struct nvmet_subsys *subsys = req->sq->ctrl->subsys;
  	u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10);
+	u32 cdw11 = le32_to_cpu(req->cmd->common.cdw11);
+	u16 ncqr = (cdw11 >> 16) & 0xffff;
+	u16 nsqr = cdw11 & 0xffff;

I meant that here we only declare, assignment should go to where these are used.

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw

Thank you

-----Original Message-----
From: Chaitanya Kulkarni <[email protected]>
Sent: Sunday, March 1, 2020 2:30 AM
To: Sagi Grimberg; Engel, Amit; [email protected]
Subject: Re: [PATCH] nvmet: return Invalid Field error on set features cmd fid 07h

[EXTERNAL EMAIL]

Sent out a patch with following comments and appropriate history.

Quoted 2 lines · Sagi Grimberg

I meant that here we only declare, assignment should go to where these are used.

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme