Commit 1040415c authored by Chaitanya Kulkarni's avatar Chaitanya Kulkarni Committed by Jens Axboe
Browse files

nvmet-auth: fix return value check in auth send



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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9db056e9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -247,8 +247,8 @@ 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) {
				if (nvmet_setup_auth(ctrl) < 0) {
					status = NVME_SC_INTERNAL;
					pr_err("ctrl %d qid 0 failed to setup"
					       "re-authentication",
					       ctrl->cntlid);