summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mark Salyzyn <salyzyn@google.com> 2016-05-31 19:44:18 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-05-31 19:44:18 +0000
commite4ecdb66d5c2eed64cbd5b267e0621cab7b8a63b (patch)
treeb0ac3be6022cd91b5b24fe9df2f0bfa275a9a3ea
parent0816520c5cd60519d8e221ed92497aa5464e3039 (diff)
parent52aa4a7a5ad85dfc364ff1f9b61e94010ef61070 (diff)
Merge "svcmgr: don't send reply to one-way txn (part deux)" into nyc-dev
-rw-r--r--cmds/servicemanager/binder.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmds/servicemanager/binder.c b/cmds/servicemanager/binder.c
index 01218c9958..27c461a27c 100644
--- a/cmds/servicemanager/binder.c
+++ b/cmds/servicemanager/binder.c
@@ -181,13 +181,18 @@ void binder_free_buffer(struct binder_state *bs,
void binder_send_reply(struct binder_state *bs,
struct binder_io *reply,
+ binder_uintptr_t buffer_to_free,
int status)
{
struct {
+ uint32_t cmd_free;
+ binder_uintptr_t buffer;
uint32_t cmd_reply;
struct binder_transaction_data txn;
} __attribute__((packed)) data;
+ data.cmd_free = BC_FREE_BUFFER;
+ data.buffer = buffer_to_free;
data.cmd_reply = BC_REPLY;
data.txn.target.ptr = 0;
data.txn.cookie = 0;
@@ -250,9 +255,11 @@ int binder_parse(struct binder_state *bs, struct binder_io *bio,
bio_init(&reply, rdata, sizeof(rdata), 4);
bio_init_from_txn(&msg, txn);
res = func(bs, txn, &msg, &reply);
- binder_free_buffer(bs, txn->data.ptr.buffer);
- if ((txn->flags & TF_ONE_WAY) == 0)
- binder_send_reply(bs, &reply, res);
+ if (txn->flags & TF_ONE_WAY) {
+ binder_free_buffer(bs, txn->data.ptr.buffer);
+ } else {
+ binder_send_reply(bs, &reply, txn->data.ptr.buffer, res);
+ }
}
ptr += sizeof(*txn);
break;