Commit bb74562a authored by Martijn Coenen's avatar Martijn Coenen Committed by Greg Kroah-Hartman

ANDROID: binder: don't enqueue death notifications to thread todo.

This allows userspace to request death notifications without
having to worry about getting an immediate callback on the same
thread; one scenario where this would be problematic is if the
death recipient handler grabs a lock that was already taken
earlier (eg as part of a nested transaction).
Signed-off-by: default avatarMartijn Coenen <maco@android.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 858b2719
...@@ -3499,23 +3499,13 @@ static int binder_thread_write(struct binder_proc *proc, ...@@ -3499,23 +3499,13 @@ static int binder_thread_write(struct binder_proc *proc,
ref->death = death; ref->death = death;
if (ref->node->proc == NULL) { if (ref->node->proc == NULL) {
ref->death->work.type = BINDER_WORK_DEAD_BINDER; ref->death->work.type = BINDER_WORK_DEAD_BINDER;
if (thread->looper &
(BINDER_LOOPER_STATE_REGISTERED |
BINDER_LOOPER_STATE_ENTERED))
binder_enqueue_work(
proc,
&ref->death->work,
&thread->todo);
else {
binder_inner_proc_lock(proc); binder_inner_proc_lock(proc);
binder_enqueue_work_ilocked( binder_enqueue_work_ilocked(
&ref->death->work, &ref->death->work, &proc->todo);
&proc->todo); binder_wakeup_proc_ilocked(proc);
binder_wakeup_proc_ilocked(
proc);
binder_inner_proc_unlock(proc); binder_inner_proc_unlock(proc);
} }
}
} else { } else {
if (ref->death == NULL) { if (ref->death == NULL) {
binder_user_error("%d:%d BC_CLEAR_DEATH_NOTIFICATION death notification not active\n", binder_user_error("%d:%d BC_CLEAR_DEATH_NOTIFICATION death notification not active\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment