Skip to content

Commit bb74562

Browse files
Martijn Coenengregkh
authored andcommitted
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: Martijn Coenen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 858b271 commit bb74562

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

drivers/android/binder.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,22 +3499,12 @@ static int binder_thread_write(struct binder_proc *proc,
34993499
ref->death = death;
35003500
if (ref->node->proc == NULL) {
35013501
ref->death->work.type = BINDER_WORK_DEAD_BINDER;
3502-
if (thread->looper &
3503-
(BINDER_LOOPER_STATE_REGISTERED |
3504-
BINDER_LOOPER_STATE_ENTERED))
3505-
binder_enqueue_work(
3506-
proc,
3507-
&ref->death->work,
3508-
&thread->todo);
3509-
else {
3510-
binder_inner_proc_lock(proc);
3511-
binder_enqueue_work_ilocked(
3512-
&ref->death->work,
3513-
&proc->todo);
3514-
binder_wakeup_proc_ilocked(
3515-
proc);
3516-
binder_inner_proc_unlock(proc);
3517-
}
3502+
3503+
binder_inner_proc_lock(proc);
3504+
binder_enqueue_work_ilocked(
3505+
&ref->death->work, &proc->todo);
3506+
binder_wakeup_proc_ilocked(proc);
3507+
binder_inner_proc_unlock(proc);
35183508
}
35193509
} else {
35203510
if (ref->death == NULL) {

0 commit comments

Comments
 (0)