diff options
author | 2021-06-12 00:35:58 +0000 | |
---|---|---|
committer | 2021-06-12 00:35:58 +0000 | |
commit | b86e26b735ee912acf23c670398f2d88fdfe5994 (patch) | |
tree | 91c17d659def0f38be52392b8079098f671f514d /libs/binder/RpcSession.cpp | |
parent | 01a6bad2e1441c4ec89d6157dc663cb43c6d9cf9 (diff) |
libbinder: RPC skip init on /dev/null
This started breaking the fuzzer, since we can't do a socket operation
on /dev/null.
Bug: N/A # yet!
Test: fuzzer no longer crashes
Change-Id: I881f63b85108ff488cb5798b1f0b96629b592329
Diffstat (limited to 'libs/binder/RpcSession.cpp')
-rw-r--r-- | libs/binder/RpcSession.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp index 931a876ac4..4f55eef2d1 100644 --- a/libs/binder/RpcSession.cpp +++ b/libs/binder/RpcSession.cpp @@ -100,7 +100,7 @@ bool RpcSession::addNullDebuggingClient() { return false; } - return addOutgoingConnection(std::move(serverFd)); + return addOutgoingConnection(std::move(serverFd), false); } sp<IBinder> RpcSession::getRootObject() { @@ -432,7 +432,7 @@ bool RpcSession::setupOneSocketConnection(const RpcSocketAddress& addr, const Rp LOG_ALWAYS_FATAL_IF(!ownershipTransferred); return true; } else { - return addOutgoingConnection(std::move(serverFd)); + return addOutgoingConnection(std::move(serverFd), true); } } @@ -440,7 +440,7 @@ bool RpcSession::setupOneSocketConnection(const RpcSocketAddress& addr, const Rp return false; } -bool RpcSession::addOutgoingConnection(unique_fd fd) { +bool RpcSession::addOutgoingConnection(unique_fd fd, bool init) { sp<RpcConnection> connection = sp<RpcConnection>::make(); { std::lock_guard<std::mutex> _l(mMutex); @@ -458,7 +458,10 @@ bool RpcSession::addOutgoingConnection(unique_fd fd) { mOutgoingConnections.push_back(connection); } - status_t status = mState->sendConnectionInit(connection, sp<RpcSession>::fromExisting(this)); + status_t status = OK; + if (init) { + mState->sendConnectionInit(connection, sp<RpcSession>::fromExisting(this)); + } { std::lock_guard<std::mutex> _l(mMutex); |