mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
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: 39fff6f3e8 ("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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user