From: Chaitanya Kulkarni <kch@nvidia.com>
To: <hare@suse.de>
Cc: <linux-nvme@lists.infradead.org>, <hch@lst.de>,
<sagi@grimberg.me>, Chaitanya Kulkarni <kch@nvidia.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH 1/2] nvmet: fix return value check in auth send
Date: Mon, 18 Jul 2022 16:12:32 -0700 [thread overview]
Message-ID: <20220718231233.3886-2-kch@nvidia.com> (raw)
In-Reply-To: <20220718231233.3886-1-kch@nvidia.com>
nvmet_setup_auth() return type is int and currently it uses status
variable that is of type u16 in nvmet_execute_auth_send().
Catch the return value of nvmet_setup_auth() into int and set the
NVME_SC_INTERNAL as status variable before we jump to error.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/nvme/target/fabrics-cmd-auth.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c
index cc56e8c821ce..f1c9c2f51afb 100644
--- a/drivers/nvme/target/fabrics-cmd-auth.c
+++ b/drivers/nvme/target/fabrics-cmd-auth.c
@@ -247,8 +247,10 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
pr_debug("%s: ctrl %d qid %d reset negotiation\n", __func__,
ctrl->cntlid, req->sq->qid);
if (!req->sq->qid) {
- status = nvmet_setup_auth(ctrl);
- if (status < 0) {
+ int ret = nvmet_setup_auth(ctrl);
+
+ if (ret < 0) {
+ status = NVME_SC_INTERNAL;
pr_err("ctrl %d qid 0 failed to setup"
"re-authentication",
ctrl->cntlid);
--
2.29.0
next prev parent reply other threads:[~2022-07-18 23:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 23:12 [PATCH 0/2] nvmet: type missmatch fixes for nvmet-auth Chaitanya Kulkarni
2022-07-18 23:12 ` Chaitanya Kulkarni [this message]
2022-07-19 6:51 ` [PATCH 1/2] nvmet: fix return value check in auth send Hannes Reinecke
2022-07-21 5:41 ` Christoph Hellwig
2022-07-18 23:12 ` [PATCH 2/2] nvmet: fix return value check in auth receive Chaitanya Kulkarni
2022-07-19 6:51 ` Hannes Reinecke
2022-07-21 22:15 ` [PATCH 0/2] nvmet: type missmatch fixes for nvmet-auth Sagi Grimberg
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=20220718231233.3886-2-kch@nvidia.com \
--to=kch@nvidia.com \
--cc=dan.carpenter@oracle.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--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