[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.1 43/54] backends/cryptodev: Do not ignore throttle/backends
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.1 43/54] backends/cryptodev: Do not ignore throttle/backends Errors |
Date: |
Tue, 23 Jan 2024 18:46:44 +0300 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
(cherry picked from commit 484aecf2d3a75251b63481be2a0c3aef635002af)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
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.39.2
- [Stable-8.2.1 v2 00/54] Patch Round-up for stable 8.2.1, freeze on 2024-01-27, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 39/54] load_elf: fix iterator's type for elf file processing, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 40/54] target/i386: Do not re-compute new pc with CF_PCREL, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 41/54] target/i386: fix incorrect EIP in PC-relative translation blocks, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 42/54] target/i386: pcrel: store low bits of physical address in data[0], Michael Tokarev, 2024/01/23
- [Stable-8.2.1 43/54] backends/cryptodev: Do not ignore throttle/backends Errors,
Michael Tokarev <=
- [Stable-8.2.1 46/54] hw/pflash: implement update buffer for block writes, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 53/54] s390x/pci: refresh fh before disabling aif, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 47/54] migration/rdma: define htonll/ntohll only if not predefined, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 44/54] hw/pflash: refactor pflash_data_write(), Michael Tokarev, 2024/01/23
- [Stable-8.2.1 52/54] s390x/pci: avoid double enable/disable of aif, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 45/54] hw/pflash: use ldn_{be,le}_p and stn_{be,le}_p, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 54/54] s390x/pci: drive ISM reset from subsystem reset, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 49/54] hw/scsi/esp-pci: generate PCI interrupt from separate ESP and PCI sources, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 51/54] hw/scsi/esp-pci: set DMA_STAT_BCMBLT when BLAST command issued, Michael Tokarev, 2024/01/23
- [Stable-8.2.1 48/54] hw/scsi/esp-pci: use correct address register for PCI DMA transfers, Michael Tokarev, 2024/01/23