]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvmet-auth: fix return value check in auth send
authorChaitanya Kulkarni <kch@nvidia.com>
Mon, 18 Jul 2022 23:12:32 +0000 (16:12 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:22:51 +0000 (17:22 -0600)
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>
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>
drivers/nvme/target/fabrics-cmd-auth.c

index cc56e8c821ce34dce7dbc89d1ec50d7a761bf27e..b785a8e27fa0792aa8441b6442e12d8dfddcd0f3 100644 (file)
@@ -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);