summaryrefslogtreecommitdiff
path: root/extra/usb_updater
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-02-20 12:15:52 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-22 18:25:14 -0800
commit5221d127e157240a1e3b2275190b2686dfafe6e5 (patch)
tree0a780de6fe424adb12867def488432bf35f69637 /extra/usb_updater
parent67c8c073eb033bc4b9c1ece57e59cbe68f54e070 (diff)
downloadchrome-ec-5221d127e157240a1e3b2275190b2686dfafe6e5.tar.gz
g: rate limit firmware updates
This patch introduces a delay between accepted cr50 firmware upload attempts. The next attempt to write into the same or lower address in flash would be accepted no sooner than in 60 seconds after the previous attempt. This would prevent a rogue user from wearing the flash by repeated uploads to the same address. This limitation is not imposed by dev images (those compiled with CR50_DEV=1). BRANCH=none BUG=chrome-os-partner:63098 TEST=verified that attempts to update soon after the previous update result in the following error message issued by usb_updater: sending 0x2d8b8 bytes to 0x4000 Error: status 0x9 Modified usb_updater to send one random pdu twice. Observed the same error message. Change-Id: Idca55ad091d09daaddd0a4cad5b1f871af1ede93 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/445496 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'extra/usb_updater')
-rw-r--r--extra/usb_updater/usb_updater.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index e41c3027b1..50d7cfaf3c 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -179,7 +179,6 @@ struct upgrade_pkt {
char data[0];
} __packed;
-#define SIGNED_TRANSFER_SIZE 1024
#define MAX_BUF_SIZE (SIGNED_TRANSFER_SIZE + sizeof(struct upgrade_pkt))
struct usb_endpoint {