summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/aboot/aboot.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index bc485dd8..846ff0ac 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2593,6 +2593,26 @@ void cmd_flash_meta_img(const char *arg, void *data, unsigned sz)
meta_header_t *meta_header;
img_header_entry_t *img_header_entry;
+ /* If device is locked:
+ * Forbid to flash image to avoid the device to bypass the image
+ * which with "any" name other than bootloader. Because it maybe
+ * a meta package of all partitions.
+ */
+#if VERIFIED_BOOT
+ if (target_build_variant_user()) {
+ if (!device.is_unlocked) {
+ fastboot_fail("Device is locked, meta image flashing is not allowed");
+ return;
+ }
+#if !VBOOT_MOTA
+ if(!device.is_unlock_critical) {
+ fastboot_fail("Device is critical locked, Meta image flashing is not allowed");
+ return;
+ }
+#endif
+ }
+#endif
+
meta_header = (meta_header_t*) data;
img_header_entry = (img_header_entry_t*) (data+sizeof(meta_header_t));