mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Revert deferred flag for keyslots and temp devices.
It could cause races later, replacing with error device is enough.
This commit is contained in:
@@ -274,5 +274,5 @@ int INTEGRITY_format(struct crypt_device *cd,
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
return dm_remove_device(cd, tmp_name, CRYPT_DEACTIVATE_FORCE|CRYPT_DEACTIVATE_DEFERRED);
|
||||
return dm_remove_device(cd, tmp_name, CRYPT_DEACTIVATE_FORCE);
|
||||
}
|
||||
|
||||
@@ -754,12 +754,6 @@ int dm_remove_device(struct crypt_device *cd, const char *name, uint32_t flags)
|
||||
if (dm_init_context(cd, DM_UNKNOWN))
|
||||
return -ENOTSUP;
|
||||
|
||||
if (flags & CRYPT_DEACTIVATE_FORCE) {
|
||||
r = dm_query_device(cd, name, 0, &dmd);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
do {
|
||||
r = _dm_remove(name, 1, flags & CRYPT_DEACTIVATE_DEFERRED) ? 0 : -EINVAL;
|
||||
if (--retries && r) {
|
||||
@@ -773,8 +767,10 @@ int dm_remove_device(struct crypt_device *cd, const char *name, uint32_t flags)
|
||||
* Anyway, if some process try to read temporary cryptsetup device,
|
||||
* it is bug - no other process should try touch it (e.g. udev).
|
||||
*/
|
||||
_error_device(name, dmd.size);
|
||||
error_target = 1;
|
||||
if (!dm_query_device(cd, name, 0, &dmd)) {
|
||||
_error_device(name, dmd.size);
|
||||
error_target = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (r == -EINVAL && retries);
|
||||
|
||||
@@ -124,7 +124,7 @@ static int LUKS_endec_template(char *src, size_t srcLength,
|
||||
out:
|
||||
if (devfd != -1)
|
||||
close(devfd);
|
||||
dm_remove_device(ctx, name, CRYPT_DEACTIVATE_FORCE|CRYPT_DEACTIVATE_DEFERRED);
|
||||
dm_remove_device(ctx, name, CRYPT_DEACTIVATE_FORCE);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user