Do not fail format actions by interrupting device wipe.

otherwise luksFormat and (integrity) format actions return
error when interrupted by user on purpose.
This commit is contained in:
Ondrej Kozina
2023-10-26 16:56:30 +02:00
parent fea8b82e8d
commit 7d17b09d41
2 changed files with 10 additions and 2 deletions

View File

@@ -1636,8 +1636,12 @@ int luksFormat(struct crypt_device **r_cd, char **r_password, size_t *r_password
tools_keyslot_msg(r, CREATED);
if (ARG_SET(OPT_INTEGRITY_ID) && !ARG_SET(OPT_INTEGRITY_NO_WIPE_ID) &&
strcmp_or_null(params2.integrity, "none"))
strcmp_or_null(params2.integrity, "none")) {
r = _wipe_data_device(cd);
/* Interrupted wipe should not fail luksFormat action */
if (r == -EINTR)
r = 0;
}
out:
crypt_safe_free(key);

View File

@@ -217,8 +217,12 @@ static int action_format(void)
log_std(_("Formatted with tag size %u, internal integrity %s.\n"),
params2.tag_size, params2.integrity);
if (!ARG_SET(OPT_NO_WIPE_ID))
if (!ARG_SET(OPT_NO_WIPE_ID)) {
r = _wipe_data_device(cd, integrity_key);
/* Interrupted wipe should not fail format action */
if (r == -EINTR)
r = 0;
}
out:
crypt_safe_free(integrity_key);
crypt_safe_free(CONST_CAST(void*)params.journal_integrity_key);