]> www.infradead.org Git - users/jedix/linux-maple.git/commit
android: binder: fix lockdep check on clearing vma
authorLiam Howlett <liam.howlett@oracle.com>
Mon, 27 Jun 2022 15:18:59 +0000 (15:18 +0000)
committerakpm <akpm@linux-foundation.org>
Wed, 20 Jul 2022 21:41:32 +0000 (14:41 -0700)
commitf640f59f69cf7c7989c658033d870ebec734a1b1
tree981bc498584c4305a88bd245921a3a01ef0bebbf
parent543d18605d2fb8bd8a712a9e708b97386c8ce61e
android: binder: fix lockdep check on clearing vma

When munmapping a vma, the mmap_lock can be degraded to a write before
calling close() on the file handle.  The binder close() function calls
binder_alloc_set_vma() to clear the vma address, which now has a lock dep
check for writing on the mmap_lock.  Change the lockdep check to ensure
the reading lock is held while clearing and keep the write check while
writing.

Link: https://lkml.kernel.org/r/20220627151857.2316964-1-Liam.Howlett@oracle.com
Fixes: 472a68df605b ("android: binder: stop saving a pointer to the VMA")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: syzbot+da54fa8d793ca89c741f@syzkaller.appspotmail.com
Acked-by: Todd Kjos <tkjos@google.com>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Christian Brauner (Microsoft) <brauner@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hridya Valsaraju <hridya@google.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Martijn Coenen <maco@android.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/android/binder_alloc.c