Skip to content

Commit

Permalink
crypto: qce - fix error return code in qce_skcipher_async_req_handle()
Browse files Browse the repository at this point in the history
commit a8bc4f5 upstream.

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 1339a7c ("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>
  • Loading branch information
Wei Yongjun authored and gregkh committed Jul 14, 2021
1 parent fb0c0a0 commit e4a577d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/crypto/qce/skcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e4a577d

Please sign in to comment.