mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 20:00:08 +01:00
Use better error message for incompatible dm-integrity metadata.
If cryptsetup/integritysetup tool is too old, it can happen that kernel dm-integrity uses more recent version of dm-integrity metadata. Print (and also traslate) better error in this case. Fixes: #667
This commit is contained in:
@@ -49,11 +49,13 @@ static int INTEGRITY_read_superblock(struct crypt_device *cd,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (read_lseek_blockwise(devfd, device_block_size(cd, device),
|
if (read_lseek_blockwise(devfd, device_block_size(cd, device),
|
||||||
device_alignment(device), sb, sizeof(*sb), offset) != sizeof(*sb) ||
|
device_alignment(device), sb, sizeof(*sb), offset) != sizeof(*sb) ||
|
||||||
memcmp(sb->magic, SB_MAGIC, sizeof(sb->magic)) ||
|
memcmp(sb->magic, SB_MAGIC, sizeof(sb->magic))) {
|
||||||
sb->version < SB_VERSION_1 || sb->version > SB_VERSION_5) {
|
log_err(cd, _("No kernel dm-integrity metadata detected on %s."), device_path(device));
|
||||||
log_std(cd, "No integrity superblock detected on %s.\n",
|
r = -EINVAL;
|
||||||
device_path(device));
|
} else if (sb->version < SB_VERSION_1 || sb->version > SB_VERSION_5) {
|
||||||
|
log_err(cd, _("Incompatible kernel dm-integrity metadata (version %u) detected on %s."),
|
||||||
|
sb->version, device_path(device));
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
sb->integrity_tag_size = le16toh(sb->integrity_tag_size);
|
sb->integrity_tag_size = le16toh(sb->integrity_tag_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user