From 68cf00580d81909ea0474123462a69673d635091 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 10 Jun 2025 21:27:46 +0000 Subject: [SP 2025-09-01] RPC Binder: clearer errors for wrong transact type Bug: 423127919 # this bug error is totally different than this case. If we hit this case, we would have gotten a different harder error. However, I found this while looking at this bug. Bug: 416734088 Test: binderRpcTest Flag: EXEMPT bug fix Change-Id: I3e0db452ebeed1a520ffc0181ed3577eb38bea9a Merged-In: I3e0db452ebeed1a520ffc0181ed3577eb38bea9a (cherry picked from commit 51ed14eebf5a6b7e0d1d6f5b9c81b01a666b270a) --- libs/binder/RpcState.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index c594d51bf0..feef2d7bd2 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -827,7 +827,12 @@ status_t RpcState::processCommand( switch (command.command) { case RPC_COMMAND_TRANSACT: - if (type != CommandType::ANY) return BAD_TYPE; + if (type != CommandType::ANY) { + ALOGE("CommandType %d, but got RPC command %d.", static_cast(type), + command.command); + (void)session->shutdownAndWait(false); + return BAD_TYPE; + } return processTransact(connection, session, command, std::move(ancillaryFds)); case RPC_COMMAND_DEC_STRONG: return processDecStrong(connection, session, command); -- cgit v1.2.3-59-g8ed1b