@@ -895,12 +895,15 @@ check_result:
if (ret == -EFAULT) {
return -1;
} else if (ret == -VIRTIO_CRYPTO_NOTSUPP) {
- virtio_crypto_req_complete(request, VIRTIO_CRYPTO_NOTSUPP);
+ virtio_crypto_req_complete(request, -VIRTIO_CRYPTO_NOTSUPP);
} else {
- cryptodev_backend_crypto_operation(vcrypto->cryptodev,
+ ret = cryptodev_backend_crypto_operation(vcrypto->cryptodev,
request, queue_index,
virtio_crypto_req_complete,
request);
+ if (ret < 0) {
+ virtio_crypto_req_complete(request, ret);
+ }
}
break;
@@ -911,7 +914,7 @@ check_result:
default:
error_report("virtio-crypto unsupported dataq opcode: %u",
opcode);
- virtio_crypto_req_complete(request, VIRTIO_CRYPTO_NOTSUPP);
+ virtio_crypto_req_complete(request, -VIRTIO_CRYPTO_NOTSUPP);
}
return 0;
- Fix memory-leak when 'virtio_crypto_handle_request' returns non-zero value. - When error occurred, always pass negative status to function 'virtio_crypto_req_complete'. Signed-off-by: Lei He <helei.sig11@bytedance.com> --- hw/virtio/virtio-crypto.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)