Commit 1f98385132 for qemu.org

commit 1f9838513258526b52b8063efa1126c1af7f92db
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Sat Apr 25 01:00:35 2026 +0400

    backends/cryptodev-lkcf: skip cleanup when not initialized

    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")
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c
index 40c7bd3c5a..3fe29d3104 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 (!cryptodev_backend_is_ready(backend)) {
+        return;
+    }
+
     qemu_mutex_lock(&lkcf->mutex);
     lkcf->running = false;
     qemu_mutex_unlock(&lkcf->mutex);