diff mbox

[-next] crypto: fix missing unlock on error in safexcel_ahash_send_req()

Message ID 1520952843-68436-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Wei Yongjun March 13, 2018, 2:54 p.m. UTC
Add the missing unlock before return from function
safexcel_ahash_send_req() in the error handling case.

Fixes: cff9a17545a3 ("crypto: inside-secure - move cache result dma mapping to request")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/crypto/inside-secure/safexcel_hash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Antoine Tenart March 13, 2018, 3:07 p.m. UTC | #1
Hi Wei,

On Tue, Mar 13, 2018 at 02:54:03PM +0000, Wei Yongjun wrote:
> Add the missing unlock before return from function
> safexcel_ahash_send_req() in the error handling case.
> 
> Fixes: cff9a17545a3 ("crypto: inside-secure - move cache result dma mapping to request")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Antoine Tenart <antoine.tenart@bootlin.com>

Thanks!
Antoine

> ---
>  drivers/crypto/inside-secure/safexcel_hash.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
> index 77268c9..6e9eb9b 100644
> --- a/drivers/crypto/inside-secure/safexcel_hash.c
> +++ b/drivers/crypto/inside-secure/safexcel_hash.c
> @@ -236,8 +236,10 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,
>  	if (cache_len) {
>  		req->cache_dma = dma_map_single(priv->dev, req->cache,
>  						cache_len, DMA_TO_DEVICE);
> -		if (dma_mapping_error(priv->dev, req->cache_dma))
> +		if (dma_mapping_error(priv->dev, req->cache_dma)) {
> +			spin_unlock_bh(&priv->ring[ring].egress_lock);
>  			return -EINVAL;
> +		}
>  
>  		req->cache_sz = cache_len;
>  		first_cdesc = safexcel_add_cdesc(priv, ring, 1,
>
Herbert Xu March 23, 2018, 3:58 p.m. UTC | #2
On Tue, Mar 13, 2018 at 02:54:03PM +0000, Wei Yongjun wrote:
> Add the missing unlock before return from function
> safexcel_ahash_send_req() in the error handling case.
> 
> Fixes: cff9a17545a3 ("crypto: inside-secure - move cache result dma mapping to request")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index 77268c9..6e9eb9b 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -236,8 +236,10 @@  static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,
 	if (cache_len) {
 		req->cache_dma = dma_map_single(priv->dev, req->cache,
 						cache_len, DMA_TO_DEVICE);
-		if (dma_mapping_error(priv->dev, req->cache_dma))
+		if (dma_mapping_error(priv->dev, req->cache_dma)) {
+			spin_unlock_bh(&priv->ring[ring].egress_lock);
 			return -EINVAL;
+		}
 
 		req->cache_sz = cache_len;
 		first_cdesc = safexcel_add_cdesc(priv, ring, 1,