Fix reencryption keys loading in kernel keyring.

Manage keys upload in kernel keyring (internal logon type for dm-crypt
segments) in single location in-before device activation.
This commit is contained in:
Ondrej Kozina
2024-11-06 11:54:23 +01:00
parent d7512d738f
commit dd3441621a
2 changed files with 4 additions and 25 deletions

View File

@@ -4506,22 +4506,11 @@ int LUKS2_reencrypt_locked_recovery_by_vks(struct crypt_device *cd,
uint64_t minimal_size, device_size;
int r = -EINVAL;
struct luks2_hdr *hdr = crypt_get_hdr(cd, CRYPT_LUKS2);
struct volume_key *vk = NULL;
log_dbg(cd, "Entering reencryption crash recovery.");
if (LUKS2_get_data_size(hdr, &minimal_size, NULL))
return r;
if (crypt_use_keyring_for_vk(cd))
vk = vks;
while (vk) {
r = LUKS2_volume_key_load_in_keyring_by_digest(cd, vk, crypt_volume_key_get_id(vk));
if (r < 0)
goto out;
vk = crypt_volume_key_next(vk);
}
if (LUKS2_reencrypt_check_device_size(cd, hdr, minimal_size, &device_size, true, false))
goto out;