(struct caam_ctx) ctx->key_dma needs to be unmapped
when context is cleaned up.

Signed-off-by: Horia Geanta <[email protected]>
---
 drivers/crypto/caam/caamalg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index b71f2fd749df..f44cfe065eb3 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -2099,6 +2099,11 @@ static void caam_cra_exit(struct crypto_tfm *tfm)
                dma_unmap_single(ctx->jrdev, ctx->sh_desc_givenc_dma,
                                 desc_bytes(ctx->sh_desc_givenc),
                                 DMA_TO_DEVICE);
+       if (ctx->key_dma &&
+           !dma_mapping_error(ctx->jrdev, ctx->key_dma))
+               dma_unmap_single(ctx->jrdev, ctx->key_dma,
+                                ctx->enckeylen + ctx->split_key_pad_len,
+                                DMA_TO_DEVICE);
 
        caam_jr_free(ctx->jrdev);
 }
-- 
1.8.3.1


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to