summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Coenen <maco@android.com>2018-03-28 11:14:50 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2018-05-11 08:53:27 +0000
commitc4048b20ffc5e8c35ec1b90032dd6aa35926225a (patch)
treed7bbbb7bc3ff940407476ffee0b2f4c405f95cd3
parentc462abbf779b6dc3501a91fdd1c667e04861777d (diff)
UPSTREAM: ANDROID: binder: prevent transactions into own process.
This can't happen with normal nodes (because you can't get a ref to a node you own), but it could happen with the context manager; to make the behavior consistent with regular nodes, reject transactions into the context manager by the process owning it. Reported-by: syzbot+09e05aba06723a94d43d@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen <maco@android.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 7aa135fcf26377f92dc0680a57566b4c7f3e281b)
-rw-r--r--drivers/android/binder.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index e7e4560e4c6e..957eb3cfab79 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -3001,6 +3001,14 @@ static void binder_transaction(struct binder_proc *proc,
else
return_error = BR_DEAD_REPLY;
mutex_unlock(&context->context_mgr_node_lock);
+ if (target_node && target_proc == proc) {
+ binder_user_error("%d:%d got transaction to context manager from process owning it\n",
+ proc->pid, thread->pid);
+ return_error = BR_FAILED_REPLY;
+ return_error_param = -EINVAL;
+ return_error_line = __LINE__;
+ goto err_invalid_target_handle;
+ }
}
if (!target_node) {
/*