binder: call poll_wait() unconditionally.
authorMartijn Coenen <maco@android.com>
Mon, 9 Oct 2017 12:26:56 +0000 (14:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Oct 2017 10:53:43 +0000 (12:53 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c

index 0621a95b8597a986801a70ed874d203be68e8c51..fddf76ef5bd6d824e2017fedb9110418b45270de 100644 (file)
@@ -3662,12 +3662,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,
@@ -4297,12 +4291,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;