66 lines
2.3 KiB
Diff
66 lines
2.3 KiB
Diff
|
|
From 690812903469db798ebae012248b9231d5ce9f11 Mon Sep 17 00:00:00 2001
|
||
|
|
From: gubin <gubin_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Sat, 22 Mar 2025 15:15:08 +0800
|
||
|
|
Subject: [PATCH] backends/cryptodev: Do not ignore throttle/backends Errors
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
cherry-pick from 484aecf2d3a75251b63481be2a0c3aef635002af
|
||
|
|
|
||
|
|
Both cryptodev_backend_set_throttle() and CryptoDevBackendClass::init()
|
||
|
|
can set their Error** argument. Do not ignore them, return early
|
||
|
|
on failure. Without that, running into another failure trips
|
||
|
|
error_setv()'s assertion. Use the ERRP_GUARD() macro as suggested
|
||
|
|
in commit ae7c80a7bd ("error: New macro ERRP_GUARD()").
|
||
|
|
|
||
|
|
Cc: qemu-stable@nongnu.org
|
||
|
|
Fixes: e7a775fd9f ("cryptodev: Account statistics")
|
||
|
|
Fixes: 2580b452ff ("cryptodev: support QoS")
|
||
|
|
Reviewed-by: zhenwei pi <pizhenwei@bytedance.com>
|
||
|
|
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
|
||
|
|
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
||
|
|
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||
|
|
Message-Id: <20231120150418.93443-1-philmd@linaro.org>
|
||
|
|
Signed-off-by: gubin <gubin_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
backends/cryptodev.c | 10 ++++++++++
|
||
|
|
1 file changed, 10 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/backends/cryptodev.c b/backends/cryptodev.c
|
||
|
|
index e5006bd215..fff89fd62a 100644
|
||
|
|
--- a/backends/cryptodev.c
|
||
|
|
+++ b/backends/cryptodev.c
|
||
|
|
@@ -398,6 +398,7 @@ static void cryptodev_backend_set_ops(Object *obj, Visitor *v,
|
||
|
|
static void
|
||
|
|
cryptodev_backend_complete(UserCreatable *uc, Error **errp)
|
||
|
|
{
|
||
|
|
+ ERRP_GUARD();
|
||
|
|
CryptoDevBackend *backend = CRYPTODEV_BACKEND(uc);
|
||
|
|
CryptoDevBackendClass *bc = CRYPTODEV_BACKEND_GET_CLASS(uc);
|
||
|
|
uint32_t services;
|
||
|
|
@@ -406,11 +407,20 @@ cryptodev_backend_complete(UserCreatable *uc, Error **errp)
|
||
|
|
QTAILQ_INIT(&backend->opinfos);
|
||
|
|
value = backend->tc.buckets[THROTTLE_OPS_TOTAL].avg;
|
||
|
|
cryptodev_backend_set_throttle(backend, THROTTLE_OPS_TOTAL, value, errp);
|
||
|
|
+ if (*errp) {
|
||
|
|
+ return;
|
||
|
|
+ }
|
||
|
|
value = backend->tc.buckets[THROTTLE_BPS_TOTAL].avg;
|
||
|
|
cryptodev_backend_set_throttle(backend, THROTTLE_BPS_TOTAL, value, errp);
|
||
|
|
+ if (*errp) {
|
||
|
|
+ return;
|
||
|
|
+ }
|
||
|
|
|
||
|
|
if (bc->init) {
|
||
|
|
bc->init(backend, errp);
|
||
|
|
+ if (*errp) {
|
||
|
|
+ return;
|
||
|
|
+ }
|
||
|
|
}
|
||
|
|
|
||
|
|
services = backend->conf.crypto_services;
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|