mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix a possible segfault in deferred deactivation.
For device without a type code shoud not try to use strcmp function. This can happen for example if deferref flag is used for device without proper DM-UUID where init_by_name does not set know device type. Thanks Clément Guérin for the report. Fixes: #910
This commit is contained in:
@@ -7081,12 +7081,15 @@ int crypt_convert(struct crypt_device *cd,
|
||||
/* Internal access function to header pointer */
|
||||
void *crypt_get_hdr(struct crypt_device *cd, const char *type)
|
||||
{
|
||||
assert(cd);
|
||||
assert(type);
|
||||
|
||||
/* One type can be OPAL */
|
||||
if (isLUKS2(type) && isLUKS2(cd->type))
|
||||
return &cd->u.luks2.hdr;
|
||||
|
||||
/* If requested type differs, ignore it */
|
||||
if (strcmp(cd->type, type))
|
||||
if (!cd->type || strcmp(cd->type, type))
|
||||
return NULL;
|
||||
|
||||
if (isPLAIN(cd->type))
|
||||
|
||||
Reference in New Issue
Block a user