crypto: caam - fix DMA API leaks for multiple setkey() calls
authorHoria Geantă <horia.geanta@nxp.com>
Fri, 10 Feb 2017 12:07:22 +0000 (14:07 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 15 Feb 2017 05:23:41 +0000 (13:23 +0800)
commitbbf2234494afd14a720d61a233c21b95e4261326
treeacff483ada06a7a1602dd7070aa31fa750951a33
parentcfb725f6d3d31355fa4510da7d7bdce807045b42
crypto: caam - fix DMA API leaks for multiple setkey() calls

setkey() callback may be invoked multiple times for the same tfm.
In this case, DMA API leaks are caused by shared descriptors
(and key for caamalg) being mapped several times and unmapped only once.
Fix this by performing mapping / unmapping only in crypto algorithm's
cra_init() / cra_exit() callbacks and sync_for_device in the setkey()
tfm callback.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamalg.c
drivers/crypto/caam/caamhash.c