nvmet-auth: add missing goto in nvmet_setup_auth()
authorHannes Reinecke <hare@suse.de>
Wed, 24 Aug 2022 07:23:16 +0000 (09:23 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 31 Aug 2022 04:57:59 +0000 (07:57 +0300)
There's a goto missing in nvmet_setup_auth(), causing a kernel oops
when nvme_auth_extract_key() fails.

Reported-by: Tal Lossos <tallossos@gmail.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/auth.c

index cf690df..c4113b4 100644 (file)
@@ -196,6 +196,7 @@ int nvmet_setup_auth(struct nvmet_ctrl *ctrl)
        if (IS_ERR(ctrl->ctrl_key)) {
                ret = PTR_ERR(ctrl->ctrl_key);
                ctrl->ctrl_key = NULL;
+               goto out_free_hash;
        }
        pr_debug("%s: using ctrl hash %s key %*ph\n", __func__,
                 ctrl->ctrl_key->hash > 0 ?