Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: qce - fix error return code in qce_skcipher_async_req_handle()

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>

authored by

Wei Yongjun and committed by
Herbert Xu
a8bc4f5e 2dcf4562

+6 -2
+6 -2
drivers/crypto/qce/skcipher.c
··· 124 124 rctx->dst_sg = rctx->dst_tbl.sgl; 125 125 126 126 dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); 127 - if (dst_nents < 0) 127 + if (dst_nents < 0) { 128 + ret = dst_nents; 128 129 goto error_free; 130 + } 129 131 130 132 if (diff_dst) { 131 133 src_nents = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src); 132 - if (src_nents < 0) 134 + if (src_nents < 0) { 135 + ret = src_nents; 133 136 goto error_unmap_dst; 137 + } 134 138 rctx->src_sg = req->src; 135 139 } else { 136 140 rctx->src_sg = rctx->dst_sg;