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>
Marc-André Lureau committed
Apr 25, 2026 at 01:00 UTC
1f9838513258526b52b8063efa1126c1af7f92db
1 file changed
+4
backends/cryptodev-lkcf.c
+4
@@ -255,6 +255,10 @@ static void cryptodev_lkcf_cleanup(CryptoDevBackend *backend, Error **errp)
255
CryptoDevBackendClient *cc;
256
CryptoDevLKCFTask *task, *next;
257
258
+ if (!cryptodev_backend_is_ready(backend)) {
259
+ return;
260
+ }
261
+
262
qemu_mutex_lock(&lkcf->mutex);
263
lkcf->running = false;
264
qemu_mutex_unlock(&lkcf->mutex);