Do not reinitialize dm backend when not needed.

device-mapper backend gets initialized with crypt_device
structure and it cannot be NULL in crypt_suspend.
This commit is contained in:
Ondrej Kozina
2023-07-26 15:37:19 +02:00
parent ad3013dfe4
commit 0a805d325c

View File

@@ -3864,14 +3864,12 @@ int crypt_suspend(struct crypt_device *cd,
if (r < 0)
return r;
ci = crypt_status(NULL, name);
ci = crypt_status(cd, name);
if (ci < CRYPT_ACTIVE) {
log_err(cd, _("Volume %s is not active."), name);
return -EINVAL;
}
dm_backend_init(cd);
r = dm_status_suspended(cd, name);
if (r < 0)
goto out;
@@ -3897,7 +3895,6 @@ int crypt_suspend(struct crypt_device *cd,
crypt_drop_keyring_key_by_description(cd, key_desc, LOGON_KEY);
free(key_desc);
out:
dm_backend_exit(cd);
return r;
}