binder_alloc: Add missing mmap_lock calls when using the VMA
authorLiam Howlett <liam.howlett@oracle.com>
Wed, 10 Aug 2022 16:02:25 +0000 (16:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Aug 2022 14:31:02 +0000 (16:31 +0200)
commitd6f35446d0769a98e9d761593d267cdd24f09ecd
treebd7a0bd371d9087d9022bb7fa7af255f8d9ba21c
parenta0e44c64b6061dda7e00b7c458e4523e2331b739
binder_alloc: Add missing mmap_lock calls when using the VMA

Take the mmap_read_lock() when using the VMA in
binder_alloc_print_pages() and when checking for a VMA in
binder_alloc_new_buf_locked().

It is worth noting binder_alloc_new_buf_locked() drops the VMA read lock
after it verifies a VMA exists, but may be taken again deeper in the
call stack, if necessary.

Fixes: a43cfc87caaf (android: binder: stop saving a pointer to the VMA)
Cc: stable <stable@kernel.org>
Reported-by: Ondrej Mosnacek <omosnace@redhat.com>
Reported-by: syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com
Tested-by: Ondrej Mosnacek <omosnace@redhat.com>
Acked-by: Carlos Llamas <cmllamas@google.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Link: https://lore.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder_alloc.c