aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXindong Xu <xindong.xu@amlogic.com>2021-10-14 10:12:40 +0800
committerMax Zhang <zhangmax@google.com>2021-10-14 04:08:21 +0000
commitff380936e098eecd03a8066722527989dcb5e27f (patch)
tree78cc60fbc3f14fb04cd1a049cc820ffcb4e3a68e
parent31fc67387a6d78371f0e8e20fe9cba76ad6357b2 (diff)
downloadu-boot-android-tv-12.0.0_r1.tar.gz
fastboot: add secure & lock check for fastboot cmd [1/1]android-tv-13.0.0_r1android-tv-12.0.0_r1android-tv-12.0.0_r1
BUG:202994010 Problem: fastboot unlock & oem cmd maybe unsafe Solution: 1. check lock state before fastboot cmds such as oem; Verify: adt3 Change-Id: Iefd67d45ba826ab4f9704643ca3afc2ba71ebc8a Signed-off-by: Xindong Xu <xindong.xu@amlogic.com>
-rw-r--r--drivers/usb/gadget/f_fastboot.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 4664911878..ae881deff8 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -1086,6 +1086,12 @@ static void cb_download(struct usb_ep *ep, struct usb_request *req)
printf("cmd cb_download is %s\n", cmd);
+ if (check_lock()) {
+ error("device is locked, can not run this cmd.Please flashing unlock & flashing unlock_critical\n");
+ fastboot_tx_write_str("FAILlocked device");
+ return;
+ }
+
strsep(&cmd, ":");
download_size = simple_strtoul(cmd, NULL, 16);
download_bytes = 0;
@@ -1154,6 +1160,11 @@ static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
static void cb_boot(struct usb_ep *ep, struct usb_request *req)
{
+ if (check_lock()) {
+ error("device is locked, can not run this cmd.Please flashing unlock & flashing unlock_critical\n");
+ fastboot_tx_write_str("FAILlocked device");
+ return;
+ }
fastboot_func->in_req->complete = do_bootm_on_complete;
fastboot_tx_write_str("OKAY");
}
@@ -1553,6 +1564,12 @@ static void cb_oem_cmd(struct usb_ep *ep, struct usb_request *req)
char cmd_str[RESPONSE_LEN];
printf("oem cmd[%s]\n", cmd);
+ if (check_lock()) {
+ error("device is locked, can not run this cmd.Please flashing unlock & flashing unlock_critical\n");
+ fastboot_tx_write_str("FAILlocked device");
+ return;
+ }
+
strsep(&cmd, " ");
printf("To run cmd[%s]\n", cmd);