drm/nouveau/secboot/acr: fix memory leak
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 24 Jul 2018 13:27:19 +0000 (08:27 -0500)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 10 Oct 2018 23:54:10 +0000 (09:54 +1000)
In case memory resources for *bl_desc* were allocated, release
them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")
Fixes: 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c

index d02e183717dc4575bd667116ab90caaaa8289968..5c14d6ac855d2c96b1622f6bc83392cc02cd52f9 100644 (file)
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
                bl = acr->hsbl_unload_blob;
        } else {
                nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+               kfree(bl_desc);
                return -EINVAL;
        }