From: amit.engel@dell.com
To: sagi@grimberg.me, linux-nvme@lists.infradead.org
Cc: Amit Engel <Amit.Engel@dell.com>
Subject: [PATCH] nvmet: return Invalid Field error on set features cmd fid 07h
Date: Fri, 28 Feb 2020 14:52:14 +0200 [thread overview]
Message-ID: <20200228125214.100729-1-amit.engel@dell.com> (raw)
From: Amit Engel <amit.engel@dell.com>
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
Signed-off-by: Amit Engel <Amit.Engel@dell.com>
---
drivers/nvme/target/admin-cmd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 19f949570625..94b0ac923e99 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -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;
--
2.16.5
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next reply other threads:[~2020-02-28 12:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 12:52 amit.engel [this message]
2020-02-28 20:33 ` [PATCH] nvmet: return Invalid Field error on set features cmd fid 07h Sagi Grimberg
2020-03-01 0:30 ` Chaitanya Kulkarni
2020-03-01 4:47 ` Engel, Amit
-- strict thread matches above, loose matches on Subject: below --
2020-02-27 14:16 amit.engel
2020-02-27 23:16 ` Sagi Grimberg
2020-02-28 12:53 ` Engel, Amit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200228125214.100729-1-amit.engel@dell.com \
--to=amit.engel@dell.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox