From: Martijn Coenen Date: Wed, 28 Mar 2018 09:14:50 +0000 (+0200) Subject: UPSTREAM: ANDROID: binder: prevent transactions into own process. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a97eec1952103b201846c14326fbc1112811e4b1;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Cc: stable Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 7aa135fcf26377f92dc0680a57566b4c7f3e281b) Change-Id: I3f6c0528fb2d3f8b835255b2a0ec603cab94626a --- diff --git a/drivers/android/binder.c b/drivers/android/binder.c index f3f5d7a08f3..c180f919c3b 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2989,6 +2989,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) { /*