[PATCH 3/6] nvmet: check and set the right err location

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Tue Feb 16 16:31:09 EST 2021


The function nvmet_execute_admin_connect() doesn't check for the right
error status value that is return from the nvmet_alloc_ctrl().

Check for NVME_SC_CONNECT_INVALID_PARAM & NVME_SC_CONNECT_INVALID_HOST
before we update the error log.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 drivers/nvme/target/fabrics-cmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
index 42bd12b8bf00..cf0baa911db2 100644
--- a/drivers/nvme/target/fabrics-cmd.c
+++ b/drivers/nvme/target/fabrics-cmd.c
@@ -191,9 +191,10 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
 	status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
 				  le32_to_cpu(c->kato), &ctrl);
 	if (status) {
-		if (status == (NVME_SC_INVALID_FIELD | NVME_SC_DNR))
+		if (status == (NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR) ||
+		    status == (NVME_SC_CONNECT_INVALID_HOST | NVME_SC_DNR))
 			req->error_loc =
-				offsetof(struct nvme_common_command, opcode);
+				offsetof(struct nvme_common_command, dptr);
 		goto out;
 	}
 
-- 
2.22.1




More information about the Linux-nvme mailing list