mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 12:00:22 +09:00
Revert "Revert "binder: Prevent context manager from incrementing ref 0""
This reverts commitf0416df755. Reason for revert: This was a "temporary" reversion to workaround what is believed to be a user-space issue. Change-Id: I5322aecfe57cd8237e6657525eb33975c4840059 Bug: 166779391 Signed-off-by: Todd Kjos <tkjos@google.com> (cherry picked from commitd1c6df6dc8) [cmllamas: Resolved merge conflict with vendor hook in binder.c] Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
@@ -2723,6 +2723,12 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
goto err_dead_binder;
|
||||
}
|
||||
e->to_node = target_node->debug_id;
|
||||
if (WARN_ON(proc == target_proc)) {
|
||||
return_error = BR_FAILED_REPLY;
|
||||
return_error_param = -EINVAL;
|
||||
return_error_line = __LINE__;
|
||||
goto err_invalid_target_handle;
|
||||
}
|
||||
trace_android_vh_binder_trans(target_proc, proc, thread, tr);
|
||||
if (security_binder_transaction(proc->cred,
|
||||
target_proc->cred) < 0) {
|
||||
@@ -3420,10 +3426,17 @@ static int binder_thread_write(struct binder_proc *proc,
|
||||
struct binder_node *ctx_mgr_node;
|
||||
mutex_lock(&context->context_mgr_node_lock);
|
||||
ctx_mgr_node = context->binder_context_mgr_node;
|
||||
if (ctx_mgr_node)
|
||||
if (ctx_mgr_node) {
|
||||
if (ctx_mgr_node->proc == proc) {
|
||||
binder_user_error("%d:%d context manager tried to acquire desc 0\n",
|
||||
proc->pid, thread->pid);
|
||||
mutex_unlock(&context->context_mgr_node_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = binder_inc_ref_for_node(
|
||||
proc, ctx_mgr_node,
|
||||
strong, NULL, &rdata);
|
||||
}
|
||||
mutex_unlock(&context->context_mgr_node_lock);
|
||||
}
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user