summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2021-06-02 11:36:45 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:56:54 +0200
commite4a577d617914293ece95b74c51530327f53bd2a (patch)
treea507aefd236b522712b2a685e9ba5e5af18d035d
parentfb0c0a04e4243d39e6dc973efa63e139d2bedfdf (diff)
downloadlinux-stable-e4a577d617914293ece95b74c51530327f53bd2a.tar.gz
linux-stable-e4a577d617914293ece95b74c51530327f53bd2a.tar.bz2
linux-stable-e4a577d617914293ece95b74c51530327f53bd2a.zip
crypto: qce - fix error return code in qce_skcipher_async_req_handle()
commit a8bc4f5e7a72e4067f5afd7e98b61624231713ca upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/crypto/qce/skcipher.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c
index 5a6559131eac..d8053789c882 100644
--- a/drivers/crypto/qce/skcipher.c
+++ b/drivers/crypto/qce/skcipher.c
@@ -123,13 +123,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;