Use the blk_device supplied by vdc encryptFstab
fs_mgr may put other dm devices on top of the raw disk, such as for checkpointing, and it hands metadata encryption the uppermost device in vdc. That's what should be encrypted, not the raw disk. Bug: 150354860 Test: Treehugger Change-Id: I279f087b1b7aded40c5a62281154851ce970ba70
This commit is contained in:
parent
deb7085453
commit
48aa90cd6b
1 changed files with 2 additions and 8 deletions
|
@ -286,11 +286,6 @@ bool fscrypt_mount_metadata_encrypted(const std::string& blk_device, const std::
|
|||
LOG(ERROR) << "Failed to get data_rec for " << mount_point;
|
||||
return false;
|
||||
}
|
||||
if (blk_device != data_rec->blk_device) {
|
||||
LOG(ERROR) << "blk_device " << blk_device << " does not match fstab entry "
|
||||
<< data_rec->blk_device << " for " << mount_point;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_legacy;
|
||||
if (!DmTargetDefaultKey::IsLegacy(&is_legacy)) return false;
|
||||
|
@ -319,8 +314,7 @@ bool fscrypt_mount_metadata_encrypted(const std::string& blk_device, const std::
|
|||
|
||||
std::string crypto_blkdev;
|
||||
uint64_t nr_sec;
|
||||
if (!create_crypto_blk_dev(kDmNameUserdata, data_rec->blk_device, key, options, &crypto_blkdev,
|
||||
&nr_sec))
|
||||
if (!create_crypto_blk_dev(kDmNameUserdata, blk_device, key, options, &crypto_blkdev, &nr_sec))
|
||||
return false;
|
||||
|
||||
// FIXME handle the corrupt case
|
||||
|
@ -341,7 +335,7 @@ bool fscrypt_mount_metadata_encrypted(const std::string& blk_device, const std::
|
|||
}
|
||||
|
||||
LOG(DEBUG) << "Mounting metadata-encrypted filesystem:" << mount_point;
|
||||
mount_via_fs_mgr(data_rec->mount_point.c_str(), crypto_blkdev.c_str());
|
||||
mount_via_fs_mgr(mount_point.c_str(), crypto_blkdev.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue