summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorfaqiang.zhu <faqiang.zhu@nxp.com>2019-07-17 15:32:00 +0800
committerfaqiang.zhu <faqiang.zhu@nxp.com>2019-07-18 14:49:41 +0800
commit77dcbf7029c0da8b991de60ba0f73a20ab1d1789 (patch)
tree5a138796f2a43df953fed4822d5a04e58c5272e8 /drivers
parentda33243320c9ebbde3f343aee7623028a440a024 (diff)
MA-15152 erase user data before setting lock/unlock status
when conduct fastboot lock/unlock operations, erase the userdata first and then set lock/unlock status to improve security level. Change-Id: I74c571c35b88afd6fdd4c287463f7209da8c15ff Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index cb37ca6cab..e8298a8dbc 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -3668,9 +3668,6 @@ static void wipe_all_userdata(void)
/* Erase the cache partition for legacy imx6/7 */
process_erase_mmc(FASTBOOT_PARTITION_CACHE, response);
#endif
- /* The unlock permissive flag is set by user and should be wiped here. */
- set_fastboot_lock_disable();
-
#if defined(AVB_RPMB) && !defined(CONFIG_IMX_TRUSTY_OS)
printf("Start stored_rollback_index wipe process....\n");
@@ -3690,12 +3687,10 @@ static FbLockState do_fastboot_unlock(bool force)
}
if ((fastboot_lock_enable() == FASTBOOT_UL_ENABLE) || force) {
printf("It is able to unlock device. %d\n",fastboot_lock_enable());
+ wipe_all_userdata();
status = fastboot_set_lock_stat(FASTBOOT_UNLOCK);
if (status < 0)
return FASTBOOT_LOCK_ERROR;
-
- wipe_all_userdata();
-
} else {
printf("It is not able to unlock device.");
return FASTBOOT_LOCK_ERROR;
@@ -3712,12 +3707,11 @@ static FbLockState do_fastboot_lock(void)
printf("The device is already locked\n");
return FASTBOOT_LOCK;
}
+ wipe_all_userdata();
status = fastboot_set_lock_stat(FASTBOOT_LOCK);
if (status < 0)
return FASTBOOT_LOCK_ERROR;
- wipe_all_userdata();
-
return FASTBOOT_LOCK;
}