linux/drivers/android
Carlos Llamas 31643d84b8 binder: fix hang of unregistered readers
With the introduction of binder_available_for_proc_work_ilocked() in
commit 1b77e9dcc3 ("ANDROID: binder: remove proc waitqueue") a binder
thread can only "wait_for_proc_work" after its thread->looper has been
marked as BINDER_LOOPER_STATE_{ENTERED|REGISTERED}.

This means an unregistered reader risks waiting indefinitely for work
since it never gets added to the proc->waiting_threads. If there are no
further references to its waitqueue either the task will hang. The same
applies to readers using the (e)poll interface.

I couldn't find the rationale behind this restriction. So this patch
restores the previous behavior of allowing unregistered threads to
"wait_for_proc_work". Note that an error message for this scenario,
which had previously become unreachable, is now re-enabled.

Fixes: 1b77e9dcc3 ("ANDROID: binder: remove proc waitqueue")
Cc: stable@vger.kernel.org
Cc: Martijn Coenen <maco@google.com>
Cc: Arve Hjønnevåg <arve@google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20240711201452.2017543-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-12 11:31:37 +02:00
..
binder_alloc_selftest.c android: binder: fix a kernel-doc enum warning 2023-12-06 08:48:26 +09:00
binder_alloc.c binder_alloc: Replace kcalloc with kvcalloc to mitigate OOM issues 2024-07-03 16:22:36 +02:00
binder_alloc.h binder: switch alloc->mutex to spinlock_t 2023-12-05 09:23:41 +09:00
binder_internal.h binder: use bitmap for faster descriptor lookup 2024-07-03 16:21:59 +02:00
binder_trace.h binder: keep vma addresses type as unsigned long 2023-12-05 09:23:38 +09:00
binder.c binder: fix hang of unregistered readers 2024-07-12 11:31:37 +02:00
binderfs.c android: removed duplicate linux/errno 2024-01-07 09:48:26 +01:00
dbitmap.h binder: use bitmap for faster descriptor lookup 2024-07-03 16:21:59 +02:00
Kconfig remove CONFIG_ANDROID 2022-07-01 10:41:09 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00