From: Chaitanya Kulkarni Date: Mon, 18 Jul 2022 23:12:33 +0000 (-0700) Subject: nvmet-auth: fix return value check in auth receive X-Git-Tag: v6.0-rc1~112^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be2ada6d0ed094c77040dc7e2d56599dd492d961;p=thirdparty%2Flinux.git nvmet-auth: fix return value check in auth receive nvmet_auth_challenge() return type is int and currently it uses status variable that is of type u16 in nvmet_execute_auth_receive(). Catch the return value of nvmet_auth_challenge() into int and set the NVME_SC_INTERNAL as status variable before we jump to error. Reported-by: Dan Carpenter Signed-off-by: Chaitanya Kulkarni Reviewed-by: Sagi Grimberg Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c index b785a8e27fa07..c851814d6cb0f 100644 --- a/drivers/nvme/target/fabrics-cmd-auth.c +++ b/drivers/nvme/target/fabrics-cmd-auth.c @@ -484,8 +484,7 @@ void nvmet_execute_auth_receive(struct nvmet_req *req) ctrl->cntlid, req->sq->qid, req->sq->dhchap_step); switch (req->sq->dhchap_step) { case NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE: - status = nvmet_auth_challenge(req, d, al); - if (status < 0) { + if (nvmet_auth_challenge(req, d, al) < 0) { pr_warn("ctrl %d qid %d: challenge error (%d)\n", ctrl->cntlid, req->sq->qid, status); status = NVME_SC_INTERNAL;