lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1432854511-33320-10-git-send-email-riandrews@android.com>
Date:	Thu, 28 May 2015 16:08:27 -0700
From:	Riley Andrews <riandrews@...roid.com>
To:	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Arve Hjønnevåg <arve@...roid.com>,
	Riley Andrews <riandrews@...roid.com>,
	devel@...verdev.osuosl.org
Subject: [PATCH 09/13] android: binder: add function for finding prior thread in transaction stack

Add a helper function to find a thread within a transaction stack.

Signed-off-by: Riley Andrews <riandrews@...roid.com>
---
 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ