diff options
-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; |