mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Fix illegal access to deallocated memory.
When deallocating context with LUKS2 reencryption handle we access data device structure after being free'd.
This commit is contained in:
@@ -2918,12 +2918,13 @@ void crypt_free(struct crypt_device *cd)
|
|||||||
dm_backend_exit(cd);
|
dm_backend_exit(cd);
|
||||||
crypt_free_volume_key(cd->volume_key);
|
crypt_free_volume_key(cd->volume_key);
|
||||||
|
|
||||||
|
crypt_free_type(cd);
|
||||||
|
|
||||||
device_free(cd, cd->device);
|
device_free(cd, cd->device);
|
||||||
device_free(cd, cd->metadata_device);
|
device_free(cd, cd->metadata_device);
|
||||||
|
|
||||||
free(CONST_CAST(void*)cd->pbkdf.type);
|
free(CONST_CAST(void*)cd->pbkdf.type);
|
||||||
free(CONST_CAST(void*)cd->pbkdf.hash);
|
free(CONST_CAST(void*)cd->pbkdf.hash);
|
||||||
crypt_free_type(cd);
|
|
||||||
|
|
||||||
/* Some structures can contain keys (TCRYPT), wipe it */
|
/* Some structures can contain keys (TCRYPT), wipe it */
|
||||||
crypt_memzero(cd, sizeof(*cd));
|
crypt_memzero(cd, sizeof(*cd));
|
||||||
|
|||||||
Reference in New Issue
Block a user