All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhenwei pi <zhenwei.pi@linux.dev>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com, "Gonglei (Arei)" <arei.gonglei@huawei.com>
Subject: Re: [PATCH 10/41] backends/cryptodev-lkcf: skip cleanup when not initialized
Date: Tue, 28 Apr 2026 08:05:32 +0800	[thread overview]
Message-ID: <b02ca6f0-619f-47c6-8578-21f8b6070a6f@linux.dev> (raw)
In-Reply-To: <20260427-qom-tests-v1-10-c413f3605311@redhat.com>



On 4/28/26 03:42, Marc-André Lureau wrote:
> cryptodev_lkcf_cleanup() locks a mutex that is only initialized
> during the init vfunc (called at realize time). When the backend
> is destroyed without ever being realized, the mutex is uninitialized
> and the lock aborts.
> 
> Return early from cleanup when the backend was never started.
> 
> Note: it looks like cryptodev init/cleanup callbacks should rather be
> regular complete/finalize overrides (calling the parent method).
> 
> Fixes: 39fff6f3e8b3 ("cryptodev: Add a lkcf-backend for cryptodev")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   backends/cryptodev-lkcf.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c
> index 40c7bd3c5a0..74db03fe96b 100644
> --- a/backends/cryptodev-lkcf.c
> +++ b/backends/cryptodev-lkcf.c
> @@ -255,6 +255,10 @@ static void cryptodev_lkcf_cleanup(CryptoDevBackend *backend, Error **errp)
>       CryptoDevBackendClient *cc;
>       CryptoDevLKCFTask *task, *next;
>   
> +    if (!lkcf->running) {
> +        return;
> +    }
> +
>       qemu_mutex_lock(&lkcf->mutex);
>       lkcf->running = false;
>       qemu_mutex_unlock(&lkcf->mutex);
> 

'lkcf->running' is used for synchronization between main thread and LKCF 
works, 'backend->ready' indicates the status of cryptodev, so I prefer 
the following code instead:

if (!cryptodev_backend_is_ready(backend)) {
     return;
}


  reply	other threads:[~2026-04-28  0:06 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 19:41 [PATCH 00/41] Fix various QOM object life-cycle issues Marc-André Lureau
2026-04-27 19:42 ` [PATCH 01/41] hw/pci: handle missing bus in prop_pci_busnr_get Marc-André Lureau
2026-04-27 19:42 ` [PATCH 02/41] chardev/char-socket: handle NULL addr in char_socket_get_addr Marc-André Lureau
2026-04-27 19:42 ` [PATCH 03/41] hw/pci-bridge: handle missing parent in prop_pxb_uid_get Marc-André Lureau
2026-04-27 19:42 ` [PATCH 04/41] hw/pci-host/i440fx: handle NULL bus in pci-hole64 getters Marc-André Lureau
2026-04-27 21:00   ` Philippe Mathieu-Daudé
2026-04-28  6:10     ` Marc-André Lureau
2026-04-28  6:14       ` Philippe Mathieu-Daudé
2026-04-27 19:42 ` [PATCH 05/41] hw/pci-host/q35: " Marc-André Lureau
2026-04-27 19:42 ` [PATCH 06/41] hw/remote: check visit return in vfu_object_set_socket Marc-André Lureau
2026-04-27 20:38   ` Jagannathan Raman
2026-04-27 19:42 ` [PATCH 07/41] qom: skip link property check callback when clearing link Marc-André Lureau
2026-04-30 15:48   ` Peter Maydell
2026-04-27 19:42 ` [PATCH 08/41] hw/intc/apic: guard against NULL cpu in set_id Marc-André Lureau
2026-04-27 20:40   ` Philippe Mathieu-Daudé
2026-05-03  8:19     ` marcandre.lureau
2026-04-27 19:42 ` [PATCH 09/41] RFC hw/remote: guard listener unregister in finalize Marc-André Lureau
2026-04-27 19:58   ` Jagannathan Raman
2026-04-28 10:17     ` Marc-André Lureau
2026-04-27 19:42 ` [PATCH 10/41] backends/cryptodev-lkcf: skip cleanup when not initialized Marc-André Lureau
2026-04-28  0:05   ` zhenwei pi [this message]
2026-04-27 19:42 ` [PATCH 11/41] RFC io/net-listener: move mutex init to instance_init Marc-André Lureau
2026-04-28  7:05   ` Daniel P. Berrangé
2026-04-29 21:08   ` Peter Xu
2026-04-27 19:42 ` [PATCH 12/41] RFC net/colo-compare: guard finalize against uninitialized state Marc-André Lureau
2026-04-29 20:58   ` Peter Xu
2026-04-29 21:09     ` Marc-André Lureau
2026-04-29 22:24       ` Peter Xu
2026-04-27 19:42 ` [PATCH 13/41] RFC system/ioport: move embedded memory region cleanup to portio_list_destroy Marc-André Lureau
2026-04-29 21:07   ` Peter Xu
2026-05-04  7:11     ` marcandre.lureau
2026-04-27 19:42 ` [PATCH 14/41] ui/console: remove console from global list on finalization Marc-André Lureau
2026-04-27 19:42 ` [PATCH 15/41] hw/i386/x86: free oem_id and oem_table_id " Marc-André Lureau
2026-04-27 20:41   ` Philippe Mathieu-Daudé
2026-04-27 19:42 ` [PATCH 16/41] hw/core/machine: free shim_filename " Marc-André Lureau
2026-04-27 19:42 ` [PATCH 17/41] hw/core/resetcontainer: free children array " Marc-André Lureau
2026-04-30 15:50   ` Peter Maydell
2026-04-27 19:42 ` [PATCH 18/41] net/filter: free old values in property setters Marc-André Lureau
2026-04-27 19:42 ` [PATCH 19/41] ui/console-vc: destroy fifo on text console finalization Marc-André Lureau
2026-04-27 19:42 ` [PATCH 20/41] target/i386/sev: add finalize functions and fix leaking setters Marc-André Lureau
2026-04-27 19:42 ` [PATCH 21/41] target/i386/kvm/tdx: free strings in tdx_guest_finalize Marc-André Lureau
2026-04-27 19:42 ` [PATCH 22/41] hw/i386/nitro_enclave: add instance finalize Marc-André Lureau
2026-04-27 19:42 ` [PATCH 23/41] net/can: free ifname on socketcan finalization Marc-André Lureau
2026-04-28  8:25   ` Pavel Pisa
2026-04-27 19:42 ` [PATCH 24/41] backends/igvm-cfg: free filename on finalization Marc-André Lureau
2026-04-28  6:55   ` Gerd Hoffmann
2026-04-27 19:42 ` [PATCH 25/41] scsi/pr-manager-helper: free path " Marc-André Lureau
2026-04-30 15:51   ` Peter Maydell
2026-04-27 19:42 ` [PATCH 26/41] accel/kvm: free device " Marc-André Lureau
2026-04-30 15:56   ` Peter Maydell
2026-04-27 19:42 ` [PATCH 27/41] system/qtest: free log " Marc-André Lureau
2026-04-30 16:01   ` Peter Maydell
2026-05-04  7:23     ` marcandre.lureau
2026-04-27 19:42 ` [PATCH 28/41] hw/i386/pc: free pcspk " Marc-André Lureau
2026-04-27 19:42 ` [PATCH 29/41] hw/fsi: move OPBus address space init to realize Marc-André Lureau
2026-04-30 16:09   ` Peter Maydell
2026-04-30 17:47     ` Cédric Le Goater
2026-04-27 19:42 ` [PATCH 30/41] hw/gpio/pca9552: fix state_str leak in pca955x_set_led Marc-André Lureau
2026-04-27 20:19   ` Miles Glenn
2026-04-27 20:46   ` Philippe Mathieu-Daudé
2026-04-27 19:42 ` [PATCH 31/41] hw/arm/aspeed: free fmc_model and spi_model on finalization Marc-André Lureau
2026-04-30 17:32   ` Cédric Le Goater
2026-04-27 19:42 ` [PATCH 32/41] hw/tpm: free PPI buffer " Marc-André Lureau
2026-04-27 20:29   ` Stefan Berger
2026-04-27 19:42 ` [PATCH 33/41] hw/arm/sbsa-ref: free unrealized flash devices " Marc-André Lureau
2026-04-27 20:49   ` Philippe Mathieu-Daudé
2026-04-27 19:42 ` [PATCH 34/41] hw/arm/virt: free flash devices and OEM strings " Marc-André Lureau
2026-04-27 20:50   ` Philippe Mathieu-Daudé
2026-04-30 15:12   ` Peter Maydell
2026-04-30 15:18     ` Philippe Mathieu-Daudé
2026-04-30 15:30       ` Peter Maydell
2026-05-11 13:01         ` Marc-André Lureau
2026-05-11 14:33           ` Peter Maydell
2026-04-27 19:42 ` [PATCH 35/41] hw/loongarch/virt: " Marc-André Lureau
2026-04-27 19:42 ` [PATCH 36/41] hw/ppc/spapr: free host_model and host_serial " Marc-André Lureau
2026-04-27 19:42 ` [PATCH 37/41] hw/ppc/pnv: drop extra ref on PHB after adding as child Marc-André Lureau
2026-04-27 20:20   ` Miles Glenn
2026-05-10  9:02   ` Aditya Gupta
2026-04-27 19:42 ` [PATCH 38/41] target/riscv: fix general_user_opts hash table leak Marc-André Lureau
2026-05-01  1:53   ` Alistair Francis
2026-05-04 10:29     ` marcandre.lureau
2026-05-05 15:43     ` Daniel Henrique Barboza
2026-04-27 19:42 ` [PATCH 39/41] hw/riscv/virt: free flash devices and OEM strings on finalization Marc-André Lureau
2026-04-27 20:51   ` Philippe Mathieu-Daudé
2026-04-28  2:19   ` Alistair Francis
2026-04-27 19:42 ` [PATCH 40/41] hw/i2c/pmbus: fix undefined behavior in pmbus_direct_mode2data Marc-André Lureau
2026-04-27 19:42 ` [PATCH 41/41] qtest: add "qom-tests" command Marc-André Lureau
2026-04-27 20:06   ` Peter Maydell
2026-04-28  6:37     ` Marc-André Lureau
2026-04-28  7:48       ` Peter Maydell

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=b02ca6f0-619f-47c6-8578-21f8b6070a6f@linux.dev \
    --to=zhenwei.pi@linux.dev \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@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.