firmware: prevent writing or opening during verification
If the current state is during verification, prevent opening blobs or
writing to blobs.
Change-Id: Ia903e52a5f8f8adaeb4372b850f798e61141d9b6
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 59ef651..4717e95 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -147,7 +147,11 @@
return false;
}
- /* TODO: Is the verification process underway? */
+ /* Is the verification process underway? */
+ if (state == UpdateState::verificationStarted)
+ {
+ return false;
+ }
/* Is there an open session already? We only allow one at a time.
* TODO: Temporarily using a simple boolean flag until there's a full
@@ -279,6 +283,12 @@
return false;
}
+ /* Prevent writing during verification. */
+ if (state == UpdateState::verificationStarted)
+ {
+ return false;
+ }
+
std::vector<std::uint8_t> bytes;
if (item->second->flags & FirmwareUpdateFlags::ipmi)