]> git.karo-electronics.de Git - linux-beck.git/commitdiff
crypto: ccp - add missing release in ccp_dmaengine_register
authorQuentin Lambert <lambert.quentin@gmail.com>
Fri, 2 Sep 2016 09:48:53 +0000 (11:48 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 7 Sep 2016 13:08:31 +0000 (21:08 +0800)
ccp_dmaengine_register used to return with an error code before
releasing all resource. This patch adds a jump to the appropriate label
ensuring that the resources are properly released before returning.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-dmaengine.c

index 94f77b0f9ae75bda4ba54211164f1c4433b9ba4e..ded26f46c7350cefa108b9cdaf9ff89050e4df0a 100644 (file)
@@ -650,8 +650,11 @@ int ccp_dmaengine_register(struct ccp_device *ccp)
        dma_desc_cache_name = devm_kasprintf(ccp->dev, GFP_KERNEL,
                                             "%s-dmaengine-desc-cache",
                                             ccp->name);
-       if (!dma_cmd_cache_name)
-               return -ENOMEM;
+       if (!dma_cmd_cache_name) {
+               ret = -ENOMEM;
+               goto err_cache;
+       }
+
        ccp->dma_desc_cache = kmem_cache_create(dma_desc_cache_name,
                                                sizeof(struct ccp_dma_desc),
                                                sizeof(void *),