diff options
author | James Christopher Adduono <jc@adduono.com> | 2017-01-21 06:17:30 +0100 |
---|---|---|
committer | James Christopher Adduono <jc@adduono.com> | 2017-01-21 06:31:36 +0100 |
commit | c51bd350403ebe91cf2e21a55625348113aa3130 (patch) | |
tree | 1fecdf69bb55f0d46718e0050dd846056eb95b32 | |
parent | Add another license header (diff) | |
download | android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.tar android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.tar.gz android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.tar.bz2 android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.tar.lz android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.tar.xz android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.tar.zst android_bootable_recovery-c51bd350403ebe91cf2e21a55625348113aa3130.zip |
-rw-r--r-- | crypto/lollipop/cryptfs.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crypto/lollipop/cryptfs.c b/crypto/lollipop/cryptfs.c index 0c7848d8f..986507e22 100644 --- a/crypto/lollipop/cryptfs.c +++ b/crypto/lollipop/cryptfs.c @@ -1328,6 +1328,21 @@ static int decrypt_master_key(char *passwd, unsigned char *decrypted_master_key, return ret; } +static int try_mount_multiple_fs(const char *crypto_blkdev, + const char *mount_point, + const char *file_system) +{ + if (!mount(crypto_blkdev, mount_point, file_system, 0, NULL)) + return 0; + if (strcmp(file_system, "ext4") && + !mount(crypto_blkdev, mount_point, "ext4", 0, NULL)) + return 0; + if (strcmp(file_system, "f2fs") && + !mount(crypto_blkdev, mount_point, "f2fs", 0, NULL)) + return 0; + return 1; +} + static int test_mount_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr, char *passwd, char *mount_point, char *label) { @@ -1426,7 +1441,7 @@ static int test_mount_encrypted_fs(struct crypt_mnt_ftr* crypt_ftr, * the footer, not the key. */ sprintf(tmp_mount_point, "%s/tmp_mnt", mount_point); mkdir(tmp_mount_point, 0755); - if (mount(crypto_blkdev, tmp_mount_point, file_system, 0, NULL) != 0) { + if (try_mount_multiple_fs(crypto_blkdev, tmp_mount_point, file_system)) { printf("Error temp mounting decrypted block device '%s'\n", crypto_blkdev); delete_crypto_blk_dev(label); rc = 1; |