[PATCH] nvmet: drop the redundant auth check in nvmet_parse_io_cmd()

shao.mingyin at zte.com.cn shao.mingyin at zte.com.cn
Wed Nov 4 05:14:46 PST 2026


From: Shao Mingyin <shao.mingyin at zte.com.cn>

nvmet_parse_io_cmd() calls nvmet_check_auth_status() and then
nvmet_check_ctrl_status(), which performs the same check again.  The
first call cannot fail either: this path only handles commands from I/O
queues, and nvmet_check_auth_status() returns true unconditionally for
qid > 0.  Drop the duplicate.

No functional change.

Signed-off-by: Shao Mingyin <shao.mingyin at zte.com.cn>
---
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index a8171b88035c..12b82bb7e412 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1120,9 +1120,6 @@ static u16 nvmet_parse_io_cmd(struct nvmet_req *req)
 	if (nvme_is_fabrics(cmd))
 		return nvmet_parse_fabrics_io_cmd(req);
 
-	if (unlikely(!nvmet_check_auth_status(req)))
-		return NVME_SC_AUTH_REQUIRED | NVME_STATUS_DNR;
-
 	ret = nvmet_check_ctrl_status(req);
 	if (unlikely(ret))
 		return ret;



More information about the Linux-nvme mailing list