[PATCH 09/13] android: binder: add function for finding prior thread in transaction stack
From: Riley Andrews
Date: Thu May 28 2015 - 19:10:24 EST
Add a helper function to find a thread within a transaction stack.
Signed-off-by: Riley Andrews <riandrews@xxxxxxxxxxx>
---
drivers/android/binder.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index f7f2217..abd5556 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -1634,6 +1634,19 @@ static int binder_tr_validate_stack(struct binder_thread *thread)
return BR_OK;
}
+struct binder_thread *binder_find_used_thread(struct binder_proc *proc,
+ struct binder_transaction *stack)
+{
+ struct binder_transaction *tr = stack;
+
+ while (tr) {
+ if (tr->from && tr->from->proc == proc)
+ return tr->from;
+ tr = tr->from_parent;
+ }
+ return NULL;
+}
+
static void binder_transaction(struct binder_thread *thread,
struct binder_transaction_data *tr, int reply)
{
@@ -1688,18 +1701,12 @@ static void binder_transaction(struct binder_thread *thread,
goto err_invalid_target_handle;
}
if (!(tr->flags & TF_ONE_WAY) && thread->transaction_stack) {
- struct binder_transaction *tmp;
-
return_error = binder_tr_validate_stack(thread);
if (return_error != BR_OK)
goto err_bad_call_stack;
- tmp = thread->transaction_stack;
- while (tmp) {
- if (tmp->from && tmp->from->proc == target_proc)
- target_thread = tmp->from;
- tmp = tmp->from_parent;
- }
+ target_thread = binder_find_used_thread(target_proc,
+ thread->transaction_stack);
}
}
if (target_thread) {
--
2.2.0.rc0.207.ga3a616c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/