mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
opal: Submit PSID reset command to R/W file descriptor.
The PSID reset erases the block device it's submitted to succesfully. By submitting the command to read-only fd previously there were partition device nodes still visible in the /dev directory because kernel does not trigger rescan after OPAL2 PSID reset. Even though all the partition were actually erased (including the partition table). We workaround the issue by submitting the PSID reset to R/W fd so that it triggers rescan event on close.
This commit is contained in:
@@ -790,7 +790,11 @@ int opal_factory_reset(struct crypt_device *cd,
|
||||
if (password_len > OPAL_KEY_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
fd = device_open(cd, dev, O_RDONLY);
|
||||
/*
|
||||
* Submit PSID reset on R/W file descriptor so it
|
||||
* triggers blkid rescan after we close it.
|
||||
*/
|
||||
fd = device_open(cd, dev, O_RDWR);
|
||||
if (fd < 0)
|
||||
return -EIO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user