linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Amit <Amit.Engel@Dell.com>
To: sagi@grimberg.me, linux-nvme@lists.infradead.org
Cc: amit.engel@dell.com
Subject: [PATCH] nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81
Date: Thu,  5 Dec 2019 10:15:41 +0200	[thread overview]
Message-ID: <20191205081541.55962-1-amit.engel@emc.com> (raw)

From: Amit Engel <amit.engel@dell.com>

In feature id 0x81 NVME_FEAT_HOST_ID, nvmet_copy_to_sgl is called
req->data_len shall hold a non-zero value which is
'sizeof(req->sq->ctrl->hostid)'

Signed-off-by: Amit Engel <amit.engel@dell.com>
---
 drivers/nvme/target/admin-cmd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 831a062d27cb..0e1668274872 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -812,6 +812,7 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
 {
 	struct nvme_command *cmd = req->cmd;
 	u16 ret;
+	u8 feature;
 
 	ret = nvmet_check_ctrl_status(req, cmd);
 	if (unlikely(ret))
@@ -875,7 +876,10 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
 		return 0;
 	case nvme_admin_get_features:
 		req->execute = nvmet_execute_get_features;
-		req->data_len = 0;
+		if (feature == NVME_FEAT_HOST_ID)
+			req->data_len = sizeof(req->sq->ctrl->hostid);
+		else
+			req->data_len = 0;
 		return 0;
 	case nvme_admin_async_event:
 		req->execute = nvmet_execute_async_event;
-- 
2.16.5


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

             reply	other threads:[~2019-12-05  8:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05  8:15 Amit [this message]
2019-12-05  8:33 ` [PATCH] nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81 Christoph Hellwig
2019-12-05 13:35   ` Engel, Amit
2019-12-09 13:21     ` Engel, Amit
2019-12-10  7:23       ` Chaitanya Kulkarni
2019-12-05 13:10 Amit
2019-12-05 13:14 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=20191205081541.55962-1-amit.engel@emc.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;
as well as URLs for NNTP newsgroup(s).