crypto: inside-secure - avoid unmapping DMA memory that was not mapped
authorAntoine Tenart <antoine.tenart@free-electrons.com>
Tue, 26 Dec 2017 16:21:16 +0000 (17:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Feb 2018 16:38:50 +0000 (17:38 +0100)
commit199d97815d32acd0f1d20cbd04e39e3dead59a8b
tree56ff7cbc203ce9264bdc30d9e81c08cc42d50d7f
parentbb9eec7b301eeb178fc1305708ae8902fa507953
crypto: inside-secure - avoid unmapping DMA memory that was not mapped

commit c957f8b3e2e54b29f53ef69decc87bbc858c9b58 upstream.

This patch adds a parameter in the SafeXcel ahash request structure to
keep track of the number of SG entries mapped. This allows not to call
dma_unmap_sg() when dma_map_sg() wasn't called in the first place. This
also removes a warning when the debugging of the DMA-API is enabled in
the kernel configuration: "DMA-API: device driver tries to free DMA
memory it has not allocated".

Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/inside-secure/safexcel_hash.c