]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/android/binder.c
binder: check for binder_thread allocation failure in binder_poll()
[linux.git] / drivers / android / binder.c
index d21040c5d343f3fafdd4e97d6bc29bc489aa35db..ad5e662e3e149a1f83d7e250ef6bac4b5e224499 100644 (file)
@@ -4371,7 +4371,7 @@ static int binder_thread_release(struct binder_proc *proc,
         */
        if ((thread->looper & BINDER_LOOPER_STATE_POLL) &&
            waitqueue_active(&thread->wait)) {
-               wake_up_poll(&thread->wait, POLLHUP | POLLFREE);
+               wake_up_poll(&thread->wait, EPOLLHUP | POLLFREE);
        }
 
        binder_inner_proc_unlock(thread->proc);
@@ -4391,6 +4391,8 @@ static __poll_t binder_poll(struct file *filp,
        bool wait_for_proc_work;
 
        thread = binder_get_thread(proc);
+       if (!thread)
+               return POLLERR;
 
        binder_inner_proc_lock(thread->proc);
        thread->looper |= BINDER_LOOPER_STATE_POLL;
@@ -4401,7 +4403,7 @@ static __poll_t binder_poll(struct file *filp,
        poll_wait(filp, &thread->wait, wait);
 
        if (binder_has_work(thread, wait_for_proc_work))
-               return POLLIN;
+               return EPOLLIN;
 
        return 0;
 }