All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"Zhenwei Pi" <pizhenwei@bytedance.com>,
	qemu-stable@nongnu.org
Subject: Re: [PATCH v3] backends/cryptodev: Do not ignore throttle/backends Errors
Date: Thu, 18 Jan 2024 19:27:04 +0100	[thread overview]
Message-ID: <87bk9i8pl3.fsf@pond.sub.org> (raw)
In-Reply-To: <20240118181955.19949-1-philmd@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Thu, 18 Jan 2024 19:19:55 +0100")

Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> 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>
> ---
>  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;

Reviewed-by: Markus Armbruster <armbru@redhat.com>



      reply	other threads:[~2024-01-18 18:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 18:19 [PATCH v3] backends/cryptodev: Do not ignore throttle/backends Errors Philippe Mathieu-Daudé
2024-01-18 18:27 ` Markus Armbruster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bk9i8pl3.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=berrange@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pizhenwei@bytedance.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.