Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <dan.carpenter@oracle.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Chaitanya Kulkarni and committed by
Jens Axboe
be2ada6d 1040415c

+1 -2
+1 -2
drivers/nvme/target/fabrics-cmd-auth.c
··· 484 484 ctrl->cntlid, req->sq->qid, req->sq->dhchap_step); 485 485 switch (req->sq->dhchap_step) { 486 486 case NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE: 487 - status = nvmet_auth_challenge(req, d, al); 488 - if (status < 0) { 487 + if (nvmet_auth_challenge(req, d, al) < 0) { 489 488 pr_warn("ctrl %d qid %d: challenge error (%d)\n", 490 489 ctrl->cntlid, req->sq->qid, status); 491 490 status = NVME_SC_INTERNAL;