Check return value of create_crypto_blk_dev()
cryptfs_enable_internal() forgot to check the return value of create_crypto_blk_dev(), so it was continuing to cryptfs_enable_inplace() when creating the dm-crypt device failed, which doesn't make sense. Test: see I08fc8465f7962abd698904b5466f3ed080d53953 Change-Id: If9f20069d0f084150aa887a350f7c0c31a6d80f2
This commit is contained in:
parent
c01995ea3b
commit
88f993b4a8
1 changed files with 7 additions and 6 deletions
13
cryptfs.cpp
13
cryptfs.cpp
|
@ -2287,13 +2287,14 @@ int cryptfs_enable_internal(int crypt_type, const char* passwd, int no_ui) {
|
||||||
}
|
}
|
||||||
|
|
||||||
decrypt_master_key(passwd, decrypted_master_key, &crypt_ftr, 0, 0);
|
decrypt_master_key(passwd, decrypted_master_key, &crypt_ftr, 0, 0);
|
||||||
create_crypto_blk_dev(&crypt_ftr, decrypted_master_key, real_blkdev.c_str(), &crypto_blkdev,
|
rc = create_crypto_blk_dev(&crypt_ftr, decrypted_master_key, real_blkdev.c_str(),
|
||||||
CRYPTO_BLOCK_DEVICE, 0);
|
&crypto_blkdev, CRYPTO_BLOCK_DEVICE, 0);
|
||||||
|
if (!rc) {
|
||||||
|
rc = cryptfs_enable_all_volumes(&crypt_ftr, crypto_blkdev.c_str(), real_blkdev.data());
|
||||||
|
|
||||||
rc = cryptfs_enable_all_volumes(&crypt_ftr, crypto_blkdev.c_str(), real_blkdev.data());
|
/* Undo the dm-crypt mapping whether we succeed or not */
|
||||||
|
delete_crypto_blk_dev(CRYPTO_BLOCK_DEVICE);
|
||||||
/* Undo the dm-crypt mapping whether we succeed or not */
|
}
|
||||||
delete_crypto_blk_dev(CRYPTO_BLOCK_DEVICE);
|
|
||||||
|
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
/* Success */
|
/* Success */
|
||||||
|
|
Loading…
Reference in a new issue