crypto: qce - fix error return code in qce_skcipher_async_req_handle()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 2 Jun 2021 11:36:45 +0000 (11:36 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Jun 2021 07:03:29 +0000 (15:03 +0800)
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 1339a7c3ba05 ("crypto: qce: skcipher: Fix incorrect sg count for dma transfers")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qce/skcipher.c

index 2594184792272128e10f48795642d4c1e057c3a1..8ff10928f581d76f2cc70f9ff380348bb20d726c 100644 (file)
@@ -124,13 +124,17 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req)
        rctx->dst_sg = rctx->dst_tbl.sgl;
 
        dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst);
-       if (dst_nents < 0)
+       if (dst_nents < 0) {
+               ret = dst_nents;
                goto error_free;
+       }
 
        if (diff_dst) {
                src_nents = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src);
-               if (src_nents < 0)
+               if (src_nents < 0) {
+                       ret = src_nents;
                        goto error_unmap_dst;
+               }
                rctx->src_sg = req->src;
        } else {
                rctx->src_sg = rctx->dst_sg;