Prevent spurious call to keymaster abort().

During the analysis of b/72953784 it was noticed that vold was calling
keymaster abort() and failing, though vold was succeeding with its
keymaster operation.  This had nothing to do with the bug, but the
presence of the error appeared to implicate keymaster, and it's bad
form in any case.  This CL correctly clears the mDevice member during
a move, so the destructor will not attempt to call abort.

Test: Build & boot
Bug: 72953784
Change-Id: Ib0700f829e87f19b089396087085585ddd6b96a5
This commit is contained in:
Shawn Willden 2018-02-07 15:06:06 -07:00
parent 0fd2626fc3
commit 3e02df8d3c

View file

@ -66,11 +66,15 @@ class KeymasterOperation {
KeymasterOperation() : mDevice{nullptr}, mOpHandle{0}, mError{km::ErrorCode::UNKNOWN_ERROR} {}
// Move Assignment
KeymasterOperation& operator=(KeymasterOperation&& rhs) {
mDevice = std::move(rhs.mDevice);
mOpHandle = std::move(rhs.mOpHandle);
mError = std::move(rhs.mError);
rhs.mError = km::ErrorCode::UNKNOWN_ERROR;
mDevice = rhs.mDevice;
rhs.mDevice = nullptr;
mOpHandle = rhs.mOpHandle;
rhs.mOpHandle = 0;
mError = rhs.mError;
rhs.mError = km::ErrorCode::UNKNOWN_ERROR;
return *this;
}