Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40b736e0 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: disallow upgrade of explicit version

If we have explicitly set a version, we want to test that that version
is actually being used, and we don't want the other side of the
connection to decide to artificially upgrade the version.

Bug: 182938972
Test: binderRpcTest (w/ Cls to simulate versions added)
Change-Id: Id784672100c0445d5ea77c4fc3b063daa5efa0b0
parent ac9df9ed
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -87,6 +87,12 @@ bool RpcSession::setProtocolVersion(uint32_t version) {
    }

    std::lock_guard<std::mutex> _l(mMutex);
    if (mProtocolVersion && version > *mProtocolVersion) {
        ALOGE("Cannot upgrade explicitly capped protocol version %u to newer version %u",
              *mProtocolVersion, version);
        return false;
    }

    mProtocolVersion = version;
    return true;
}