Open device in locked mode for wipe when necessary.

This commit is contained in:
Ondrej Kozina
2019-05-29 10:46:27 +02:00
parent 44aabc3ae4
commit 82f640e360

View File

@@ -157,6 +157,9 @@ int crypt_wipe_device(struct crypt_device *cd,
if (MISALIGNED_512(offset) || MISALIGNED_512(length) || MISALIGNED_512(wipe_block_size))
return -EINVAL;
if (device_is_locked(device))
devfd = device_open_locked(cd, device, O_RDWR);
else
devfd = device_open(cd, device, O_RDWR);
if (devfd < 0)
return errno ? -errno : -EINVAL;