mgmt/imgmgr: Clear upload state on erase
This fixes
When an `image erase` command is successfully processed, reset the
in-progress upload (if any).  Prior to this commit, a subsequent upload
could resume an aborted upload, even if the partial image had since been
erased.
@@ -442,6 +442,10 @@ imgr_erase(struct mgmt_cbuf *cb)
if (g_err) {
return MGMT_ERR_ENOMEM;
}
+
+ /* Reset in-progress upload. */
+ imgr_state.area_id = -1;
+
return 0;
}
@@ -486,6 +490,9 @@ imgr_erase_state(struct mgmt_cbuf *cb)
return MGMT_ERR_ENOMEM;
}
+ /* Reset in-progress upload. */
+ imgr_state.area_id = -1;
+
return 0;
}
