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
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 <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
Reviewed-by: Thara Gopinath <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Wei Yongjun authored and herbertx committed Jun 11, 2021
1 parent 2dcf456 commit a8bc4f5
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 @@ -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;
Expand Down

0 comments on commit a8bc4f5

Please sign in to comment.