Skip to content

Commit 4be5a28

Browse files
ebiggersgregkh
authored andcommitted
binder: check for binder_thread allocation failure in binder_poll()
commit f889826 upstream. If the kzalloc() in binder_get_thread() fails, binder_poll() dereferences the resulting NULL pointer. Fix it by returning POLLERR if the memory allocation failed. This bug was found by syzkaller using fault injection. Reported-by: syzbot <[email protected]> Fixes: 457b9a6 ("Staging: android: add binder driver") Cc: [email protected] Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2dfe49d commit 4be5a28

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/android/binder.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,6 +2628,8 @@ static unsigned int binder_poll(struct file *filp,
26282628
binder_lock(__func__);
26292629

26302630
thread = binder_get_thread(proc);
2631+
if (!thread)
2632+
return POLLERR;
26312633

26322634
wait_for_proc_work = thread->transaction_stack == NULL &&
26332635
list_empty(&thread->todo) && thread->return_error == BR_OK;

0 commit comments

Comments
 (0)