Skip to content

Commit 10e5ab1

Browse files
committed
tcrypt: Fix detecting status of chained modes
The function dm_uuid_cmp cannot be used for TCRYPT, it expects LUKS UUID, not a device name. Fixes: #952
1 parent 57a8837 commit 10e5ab1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/tcrypt/tcrypt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,14 +928,16 @@ int TCRYPT_activate(struct crypt_device *cd,
928928

929929
static bool is_tcrypt_subdev(const char *dm_uuid, const char *base_uuid)
930930
{
931+
const char *base_uuid_name;
932+
931933
assert(base_uuid);
934+
base_uuid_name = strchr(base_uuid, '-');
932935

933-
if (!dm_uuid)
936+
if (!dm_uuid || !base_uuid_name)
934937
return false;
935938

936939
if (!strncmp(dm_uuid, "SUBDEV-", 7))
937-
/* dm_uuid + 6 because function requires dm_uuid to contain '-' */
938-
return !dm_uuid_cmp(dm_uuid + 6, strchr(base_uuid, '-'));
940+
return !strncmp(dm_uuid + 6, base_uuid_name, strlen(base_uuid_name));
939941

940942
/*
941943
* FIXME: Drop after shift to dependency based deactivation (CRYPT_SUBDEV)

0 commit comments

Comments
 (0)