* [PATCH] ANDROID: binder: call poll_wait() unconditionally.
@ 2017-10-09 12:26 Martijn Coenen
2017-10-09 12:37 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Martijn Coenen @ 2017-10-09 12:26 UTC (permalink / raw)
To: gregkh, john.stultz, tkjos, arve
Cc: linux-kernel, devel, maco, malchev, Martijn Coenen
Because we're not guaranteed that subsequent calls
to poll() will have a poll_table_struct parameter
with _qproc set. When _qproc is not set, poll_wait()
is a noop, and we won't be woken up correctly.
Signed-off-by: Martijn Coenen <maco@android.com>
---
drivers/android/binder.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index d055b3f2a207..99f77fec1aaa 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -3623,12 +3623,6 @@ static void binder_stat_br(struct binder_proc *proc,
}
}
-static int binder_has_thread_work(struct binder_thread *thread)
-{
- return !binder_worklist_empty(thread->proc, &thread->todo) ||
- thread->looper_need_return;
-}
-
static int binder_put_node_cmd(struct binder_proc *proc,
struct binder_thread *thread,
void __user **ptrp,
@@ -4258,12 +4252,9 @@ static unsigned int binder_poll(struct file *filp,
binder_inner_proc_unlock(thread->proc);
- if (binder_has_work(thread, wait_for_proc_work))
- return POLLIN;
-
poll_wait(filp, &thread->wait, wait);
- if (binder_has_thread_work(thread))
+ if (binder_has_work(thread, wait_for_proc_work))
return POLLIN;
return 0;
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ANDROID: binder: call poll_wait() unconditionally.
2017-10-09 12:26 [PATCH] ANDROID: binder: call poll_wait() unconditionally Martijn Coenen
@ 2017-10-09 12:37 ` Greg KH
2017-10-09 12:46 ` Martijn Coenen
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2017-10-09 12:37 UTC (permalink / raw)
To: Martijn Coenen
Cc: john.stultz, tkjos, arve, devel, malchev, maco, linux-kernel
On Mon, Oct 09, 2017 at 02:26:56PM +0200, Martijn Coenen wrote:
> Because we're not guaranteed that subsequent calls
> to poll() will have a poll_table_struct parameter
> with _qproc set. When _qproc is not set, poll_wait()
> is a noop, and we won't be woken up correctly.
>
> Signed-off-by: Martijn Coenen <maco@android.com>
> ---
> drivers/android/binder.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
Does this need to get into 4.14-final, or is 4.15-rc1 ok? I'm a bit
lost as to which patches I applied to what tree...
thanks,
greg "drowning in trees" k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ANDROID: binder: call poll_wait() unconditionally.
2017-10-09 12:37 ` Greg KH
@ 2017-10-09 12:46 ` Martijn Coenen
0 siblings, 0 replies; 3+ messages in thread
From: Martijn Coenen @ 2017-10-09 12:46 UTC (permalink / raw)
To: Greg KH
Cc: John Stultz, Todd Kjos, Arve Hjønnevåg, devel,
Iliyan Malchev, Martijn Coenen, LKML
On Mon, Oct 9, 2017 at 2:37 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> Does this need to get into 4.14-final, or is 4.15-rc1 ok? I'm a bit
> lost as to which patches I applied to what tree...
This fixes a race that is somewhat hard to hit, I've only ever seen it
with test code that creates the right conditions. But when it does hit
it's pretty bad (process blocks forever), so 4.14 would be my
preference. I just looked at v4.14-rc4 and it applied cleanly.
>
> thanks,
>
> greg "drowning in trees" k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-09 12:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09 12:26 [PATCH] ANDROID: binder: call poll_wait() unconditionally Martijn Coenen
2017-10-09 12:37 ` Greg KH
2017-10-09 12:46 ` Martijn Coenen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox