android_kernel_oneplus_msm8998/drivers/android
Todd Kjos c88a3ec1ee UPSTREAM: binder: fix proc->files use-after-free
proc->files cleanup is initiated by binder_vma_close. Therefore
a reference on the binder_proc is not enough to prevent the
files_struct from being released while the binder_proc still has
a reference. This can lead to an attempt to dereference the
stale pointer obtained from proc->files prior to proc->files
cleanup. This has been seen once in task_get_unused_fd_flags()
when __alloc_fd() is called with a stale "files".

The fix is to protect proc->files with a mutex to prevent cleanup
while in use.

Signed-off-by: Todd Kjos <tkjos@google.com>
Cc: stable <stable@vger.kernel.org> # 4.14
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7f3dc0088b98533f17128058fac73cd8b2752ef1)

Change-Id: I40982bb0b4615bda5459538c20eb2a913964042c
2018-07-17 12:48:06 +02:00
..
binder.c UPSTREAM: binder: fix proc->files use-after-free 2018-07-17 12:48:06 +02:00
binder_alloc.c UPSTREAM: ANDROID: binder: change down_write to down_read 2018-07-17 12:48:06 +02:00
binder_alloc.h UPSTREAM: android: binder: Check for errors in binder_alloc_shrinker_init(). 2018-07-17 12:48:04 +02:00
binder_alloc_selftest.c FROMLIST: android: binder: Add global lru shrinker to binder 2017-08-31 17:29:45 -07:00
binder_trace.h ANDROID: binder: Add tracing for binder priority inheritance. 2017-10-05 09:58:05 +02:00
Kconfig UPSTREAM: ANDROID: binder: remove 32-bit binder interface. 2018-07-17 12:48:05 +02:00
Makefile FROMLIST: android: binder: Add allocator selftest 2017-08-31 17:29:30 -07:00