Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image erase: allow only when slot image is not backup/pending... #11

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

nvlsianpu
Copy link
Contributor

It was possible to erase slot 1 while it stores confirmed image
while ongoing test run - this is unwanted behavior which allow
to even brick remote device accidentally.
This patch add check for such case of test run etc.
This also aligns condition required for erase command
execution to similar as upload command requires.

Signed-off-by: Andrzej Puzdrowski [email protected]

@nvlsianpu
Copy link
Contributor Author

Can you look at this @ccollins476ad @carlescufi

@utzig utzig requested a review from ccollins476ad August 21, 2018 14:21
@utzig
Copy link
Member

utzig commented Aug 21, 2018

I think you should be returning MGMT_ERR_EBADSTATE instead of MGMT_ERR_ENOMEM.

It was possible to erase slot 1 while it stores confirmed image
while ongoing test run - this is unwanted behavior which allow
to even brick remote device accidentally.
This patch add check for such case of test run etc.
This also aligns condition required for erase command
execution to similar as upload command requires.

Signed-off-by: Andrzej Puzdrowski <[email protected]>
@nvlsianpu
Copy link
Contributor Author

Changed. I think here:
https://github.com/apache/mynewt-mcumgr/pull/11/files#diff-265d4384c83b545f6d7e6837596331bcR295
the same error-code should be used. What do you think?

@utzig
Copy link
Member

utzig commented Sep 10, 2018

I think the second one actually makes a little sense semantically, because if there is no available slot it could be "no mem", but erasing "no mem" would be weirder, so makes more sense to say it cannot erase because of a bad state.

@nvlsianpu
Copy link
Contributor Author

@utzig merge?

Copy link

@rymanluk rymanluk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sjanc sjanc merged commit 91a76b9 into apache:master Oct 3, 2018
mlaz pushed a commit to mlaz/mynewt-mcumgr that referenced this pull request Oct 2, 2019
Closing CBOR containers on error situations before returning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants