crypto: qce - Fix some error handling path
Fix to return negative error code from the error handling
cases instead of 0.
Fixes: 9363efb418 ("crypto: qce - Add support for AEAD algorithms")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -280,8 +280,10 @@ qce_aead_ccm_prepare_buf_assoclen(struct aead_request *req)
|
|||||||
|
|
||||||
if (diff_dst) {
|
if (diff_dst) {
|
||||||
sg = qce_aead_prepare_dst_buf(req);
|
sg = qce_aead_prepare_dst_buf(req);
|
||||||
if (IS_ERR(sg))
|
if (IS_ERR(sg)) {
|
||||||
|
ret = PTR_ERR(sg);
|
||||||
goto err_free;
|
goto err_free;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IS_ENCRYPT(rctx->flags))
|
if (IS_ENCRYPT(rctx->flags))
|
||||||
rctx->dst_nents = rctx->src_nents + 1;
|
rctx->dst_nents = rctx->src_nents + 1;
|
||||||
@@ -448,13 +450,17 @@ qce_aead_async_req_handle(struct crypto_async_request *async_req)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst);
|
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;
|
goto error_free;
|
||||||
|
}
|
||||||
|
|
||||||
if (diff_dst) {
|
if (diff_dst) {
|
||||||
src_nents = dma_map_sg(qce->dev, rctx->src_sg, rctx->src_nents, dir_src);
|
src_nents = dma_map_sg(qce->dev, rctx->src_sg, rctx->src_nents, dir_src);
|
||||||
if (src_nents < 0)
|
if (src_nents < 0) {
|
||||||
|
ret = src_nents;
|
||||||
goto error_unmap_dst;
|
goto error_unmap_dst;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IS_CCM(rctx->flags) && IS_DECRYPT(rctx->flags))
|
if (IS_CCM(rctx->flags) && IS_DECRYPT(rctx->flags))
|
||||||
src_nents = dst_nents;
|
src_nents = dst_nents;
|
||||||
|
|||||||
Reference in New Issue
Block a user