]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
misc: tegra-cryptodev: fix resource leak
authorSri Krishna chowdary <schowdary@nvidia.com>
Mon, 29 Oct 2012 11:53:27 +0000 (17:23 +0530)
committerLaxman Dewangan <ldewangan@nvidia.com>
Wed, 20 Apr 2016 15:51:20 +0000 (08:51 -0700)
Memory allocated from ablkcipher_request_alloc is
not deallocated before function returns when
crypt_req->keylen is invalid.

Bug 1046331

Change-Id: I9d74159c0653b5b5d08e3d0d00b1919590d7599f
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/159533
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Rebase-Id: R35219bc071a902129ee2948b023d14e95c8213c0
Change-Id: I198f010de3944e4c334a9de89dd680d3340e70db
Reviewed-on: http://git-master/r/1129646
Tested-by: Venkata Jagadish <vjagadish@nvidia.com>
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
drivers/misc/tegra-cryptodev.c

index ddd37d744cdc85c30c3ce5f55bbc4a647170f6a7..edc2d17645a92693cc71cf1f108f9fe6172ee9a1 100644 (file)
@@ -239,8 +239,11 @@ static int process_crypt_req(struct tegra_crypto_ctx *ctx, struct tegra_crypt_re
                return -ENOMEM;
        }
 
-       if ((crypt_req->keylen < 0) || (crypt_req->keylen > AES_MAX_KEY_SIZE))
-               return -EINVAL;
+       if ((crypt_req->keylen < 0) || (crypt_req->keylen > AES_MAX_KEY_SIZE)) {
+               ret = -EINVAL;
+               pr_err("crypt_req keylen invalid");
+               goto process_req_out;
+       }
 
        crypto_ablkcipher_clear_flags(tfm, ~0);