binder: fix possible UAF when freeing buffer
authorTodd Kjos <tkjos@android.com>
Wed, 12 Jun 2019 20:29:27 +0000 (13:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:30:53 +0000 (09:30 +0200)
commit22068d49d09d2b3890e19d7b2048a33340f992da
tree27f9674ee68b99e95c6f483ac5fdfd7b1da28659
parentba2c247a451570c2bbc9f248b0a8730dcd4146a2
binder: fix possible UAF when freeing buffer

commit a370003cc301d4361bae20c9ef615f89bf8d1e8a upstream.

There is a race between the binder driver cleaning
up a completed transaction via binder_free_transaction()
and a user calling binder_ioctl(BC_FREE_BUFFER) to
release a buffer. It doesn't matter which is first but
they need to be protected against running concurrently
which can result in a UAF.

Signed-off-by: Todd Kjos <tkjos@google.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder.c