]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ANDROID: binder: remove waitqueue when thread exits.
authorMartijn Coenen <maco@android.com>
Fri, 5 Jan 2018 10:27:07 +0000 (11:27 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Sat, 3 Feb 2018 17:40:55 +0000 (18:40 +0100)
commit2fb52726f4342f1b36944078f87994dd214fe9a7
treeee97ba9174f8dbf1cad11fe1a13d82e1103bca0b
parent9bb046e42bf0c81f8f5fc3068427fbe260eee11b
ANDROID: binder: remove waitqueue when thread exits.

BugLink: http://bugs.launchpad.net/bugs/1747169
commit f5cb779ba16334b45ba8946d6bfa6d9834d1527f upstream.

binder_poll() passes the thread->wait waitqueue that
can be slept on for work. When a thread that uses
epoll explicitly exits using BINDER_THREAD_EXIT,
the waitqueue is freed, but it is never removed
from the corresponding epoll data structure. When
the process subsequently exits, the epoll cleanup
code tries to access the waitlist, which results in
a use-after-free.

Prevent this by using POLLFREE when the thread exits.

Signed-off-by: Martijn Coenen <maco@android.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/android/binder.c