diff options
author | Horia Geantă <horia.geanta@nxp.com> | 2017-02-10 14:07:23 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-02-15 13:23:42 +0800 |
commit | 87ec02e7409d787348c244039aa3536a812dfa8b (patch) | |
tree | 097f6cd4c4ae13bdcd3e9b98b0a8c5a2b7f3f914 /crypto/mcryptd.c | |
parent | bbf2234494afd14a720d61a233c21b95e4261326 (diff) |
crypto: caam - fix error path for ctx_dma mapping failure
In case ctx_dma dma mapping fails, ahash_unmap_ctx() tries to
dma unmap an invalid address:
map_seq_out_ptr_ctx() / ctx_map_to_sec4_sg() -> goto unmap_ctx ->
-> ahash_unmap_ctx() -> dma unmap ctx_dma
There is also possible to reach ahash_unmap_ctx() with ctx_dma
uninitialzed or to try to unmap the same address twice.
Fix these by setting ctx_dma = 0 where needed:
-initialize ctx_dma in ahash_init()
-clear ctx_dma in case of mapping error (instead of holding
the error code returned by the dma map function)
-clear ctx_dma after each unmapping
Fixes: 32686d34f8fb6 ("crypto: caam - ensure that we clean up after an error")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/mcryptd.c')
0 files changed, 0 insertions, 0 deletions