binder: Make sure BR_TRANSACTION_COMPLETE is handled before reply

With fine-grained locking, it may be possible for a remote proc to
respond to a transaction before the BINDER_WORK_TRANSACTION_COMPLTE
is enqueued for a thread. To prevent this, enqueue it prior to
enqueing the BINDER_WORK_TRANSACTION on the remote thread/proc.

Bug: 34722727
Change-Id: I00ead3723f8cb828372832544d483f6ab3b58a8e
Test: Tested manually
This commit is contained in:
Todd Kjos
2017-01-27 16:05:34 -08:00
committed by Thierry Strudel
parent cfc2155f1b
commit fade544640

View File

@@ -2119,6 +2119,7 @@ static void binder_transaction(struct binder_proc *proc,
BUG_ON(!target_list);
t->work.type = BINDER_WORK_TRANSACTION;
tcomplete->type = BINDER_WORK_TRANSACTION_COMPLETE;
binder_enqueue_work(tcomplete, &thread->todo, __LINE__);
if (reply) {
BUG_ON(t->buffer->async_transaction != 0);
@@ -2150,7 +2151,6 @@ static void binder_transaction(struct binder_proc *proc,
binder_enqueue_work(&t->work, target_list, __LINE__);
binder_proc_unlock(target_node->proc, __LINE__);
}
binder_enqueue_work(tcomplete, &thread->todo, __LINE__);
if (target_wait) {
/*